diff --git a/.gitignore b/.gitignore index 2e05970..b55ec3f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -SOURCES/clang-11.0.1.src.tar.xz -SOURCES/llvm-11.0.1.src.tar.xz +SOURCES/clang-12.0.1.src.tar.xz +SOURCES/llvm-12.0.1.src.tar.xz diff --git a/.llvm-compat.metadata b/.llvm-compat.metadata index 07f3fa1..30bcc2b 100644 --- a/.llvm-compat.metadata +++ b/.llvm-compat.metadata @@ -1,2 +1,2 @@ -10516c6d177dc3d893e640c75d891ee3d6c1edcf SOURCES/clang-11.0.1.src.tar.xz -1a911295260d4e41116b72788eb602702b4bb252 SOURCES/llvm-11.0.1.src.tar.xz +e3cdd3fb39c78a5bcb0a1d5706678cf8643a48f6 SOURCES/clang-12.0.1.src.tar.xz +619fe668e0972d11d0fa2db670a57a42d02fb8ca SOURCES/llvm-12.0.1.src.tar.xz diff --git a/SOURCES/0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch b/SOURCES/0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch index 0050b40..a3c514a 100644 --- a/SOURCES/0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch +++ b/SOURCES/0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch @@ -1,8 +1,8 @@ -From 67013ee5feecca0c1e1dd8a149b20779a9b6c12a Mon Sep 17 00:00:00 2001 +From d8af49687765744efaae7ba0f0c4c0fcd58a0e31 Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Wed, 23 Sep 2020 12:47:30 +0000 -Subject: [PATCH] Driver: Prefer gcc toolchains with libgcc_s.so when not - static linking libgcc +Subject: [PATCH 4/6] [PATCH][clang] Prefer gcc toolchains with libgcc_s.so + when not static linking libgcc Fedora ships cross-compilers on all platforms, so a user could end up with a gcc x86_64 cross-compiler installed on an x86_64 system. clang @@ -21,22 +21,22 @@ This patch fixes this by checking for the existence of libgcc_s.so when it is required and taking that into account when selecting a toolchain. --- - lib/Driver/ToolChains/Gnu.cpp | 16 ++++++++++++++-- - lib/Driver/ToolChains/Gnu.h | 4 +++- - .../usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o | 0 - .../usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o | 0 - .../lib/gcc/x86_64-redhat-linux/7/libgcc_s.so | 0 - test/Driver/linux-ld.c | 12 ++++++++++++ + lib/Driver/ToolChains/Gnu.cpp | 16 ++++++++++++++-- + lib/Driver/ToolChains/Gnu.h | 4 +++- + .../usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o | 0 + .../usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o | 0 + .../usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so | 0 + ang/test/Driver/linux-ld.c | 12 ++++++++++++ 6 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o create mode 100644 test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o create mode 100644 test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp -index c8a7fce0..f28792b7 100644 +index 5deeb10..5d51517 100644 --- a/lib/Driver/ToolChains/Gnu.cpp +++ b/lib/Driver/ToolChains/Gnu.cpp -@@ -2500,6 +2500,8 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( +@@ -2539,6 +2539,8 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( (TargetArch == llvm::Triple::x86 && TargetTriple.getOS() != llvm::Triple::Solaris)}}; @@ -45,7 +45,7 @@ index c8a7fce0..f28792b7 100644 for (auto &Suffix : Suffixes) { if (!Suffix.Active) continue; -@@ -2517,8 +2519,17 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( +@@ -2556,8 +2558,17 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( continue; // Saw this path before; no need to look at it again. if (CandidateVersion.isOlderThan(4, 1, 1)) continue; @@ -65,7 +65,7 @@ index c8a7fce0..f28792b7 100644 if (!ScanGCCForMultilibs(TargetTriple, Args, LI->path(), NeedsBiarchSuffix)) -@@ -2532,6 +2543,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( +@@ -2571,6 +2582,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( GCCInstallPath = (LibDir + "/" + LibSuffix + "/" + VersionText).str(); GCCParentLibPath = (GCCInstallPath + "/../" + Suffix.ReversePath).str(); IsValid = true; @@ -74,7 +74,7 @@ index c8a7fce0..f28792b7 100644 } } diff --git a/lib/Driver/ToolChains/Gnu.h b/lib/Driver/ToolChains/Gnu.h -index 52690ab4..2a4452d9 100644 +index 90d3baf..9d0cea2 100644 --- a/lib/Driver/ToolChains/Gnu.h +++ b/lib/Driver/ToolChains/Gnu.h @@ -190,6 +190,7 @@ public: @@ -85,8 +85,8 @@ index 52690ab4..2a4452d9 100644 llvm::Triple GCCTriple; const Driver &D; -@@ -213,7 +214,8 @@ public: - MultilibSet Multilibs; +@@ -216,7 +217,8 @@ public: + const std::string GentooConfigDir = "/etc/env.d/gcc"; public: - explicit GCCInstallationDetector(const Driver &D) : IsValid(false), D(D) {} @@ -97,15 +97,15 @@ index 52690ab4..2a4452d9 100644 diff --git a/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o b/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o new file mode 100644 -index 00000000..e69de29b +index 0000000..e69de29 diff --git a/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o b/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o new file mode 100644 -index 00000000..e69de29b +index 0000000..e69de29 diff --git a/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so b/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so new file mode 100644 -index 00000000..e69de29b +index 0000000..e69de29 diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c -index ec539522..95725d5c 100644 +index 24d3c78..071bb9b 100644 --- a/test/Driver/linux-ld.c +++ b/test/Driver/linux-ld.c @@ -784,6 +784,18 @@ @@ -128,5 +128,5 @@ index ec539522..95725d5c 100644 // RUN: --target=arm-unknown-linux-gnueabi -rtlib=platform \ // RUN: --gcc-toolchain="" \ -- -2.25.2 +1.8.3.1 diff --git a/SOURCES/0001-Make-funwind-tables-the-default-for-all-archs.patch b/SOURCES/0001-Make-funwind-tables-the-default-for-all-archs.patch deleted file mode 100644 index b3d115c..0000000 --- a/SOURCES/0001-Make-funwind-tables-the-default-for-all-archs.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 690373af5a5d50cf115ed6e4d2849bb786f9dc8e Mon Sep 17 00:00:00 2001 -From: serge-sans-paille -Date: Tue, 10 Dec 2019 09:18:03 +0000 -Subject: [PATCH] Make -funwind-tables the default for all archs - ---- - clang/lib/Driver/ToolChain.cpp | 2 +- - clang/lib/Driver/ToolChains/Gnu.cpp | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git clang-a/lib/Driver/ToolChain.cpp clang-b/lib/Driver/ToolChain.cpp -index b1fddb0af55..43af40ed0e8 100644 ---- clang-a/lib/Driver/ToolChain.cpp -+++ clang-b/lib/Driver/ToolChain.cpp -@@ -244,7 +244,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const { - } - - bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const { -- return false; -+ return true; - } - - Tool *ToolChain::getClang() const { -diff --git clang-a/lib/Driver/ToolChains/Gnu.cpp clang-b/lib/Driver/ToolChains/Gnu.cpp -index 33cdd3585c2..15e82be8f3a 100644 ---- clang-a/lib/Driver/ToolChains/Gnu.cpp -+++ clang-b/lib/Driver/ToolChains/Gnu.cpp -@@ -2535,7 +2535,7 @@ void Generic_GCC::printVerboseInfo(raw_ostream &OS) const { - } - - bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const { -- return getArch() == llvm::Triple::x86_64; -+ return true; - } - - bool Generic_GCC::isPICDefault() const { --- -2.20.1 - diff --git a/SOURCES/0001-MemCpyOpt-Correctly-merge-alias-scopes-during-call-s.patch b/SOURCES/0001-MemCpyOpt-Correctly-merge-alias-scopes-during-call-s.patch deleted file mode 100644 index 411d94f..0000000 --- a/SOURCES/0001-MemCpyOpt-Correctly-merge-alias-scopes-during-call-s.patch +++ /dev/null @@ -1,373 +0,0 @@ -From e804574cad8efa1b7a660848ef7adc871a7f850e Mon Sep 17 00:00:00 2001 -From: modimo -Date: Thu, 3 Dec 2020 09:23:37 -0800 -Subject: [PATCH] [MemCpyOpt] Correctly merge alias scopes during call slot - optimization - -When MemCpyOpt performs call slot optimization it will concatenate the `alias.scope` metadata between the function call and the memcpy. However, scoped AA relies on the domains in metadata to be maintained in a caller-callee relationship. Naive concatenation breaks this assumption leading to bad AA results. - -The fix is to take the intersection of domains then union the scopes within those domains. - -The original bug came from a case of rust bad codegen which uses this bad aliasing to perform additional memcpy optimizations. As show in the added test case `%src` got forwarded past its lifetime leading to a dereference of garbage data. - -Testing -ninja check-llvm - -Reviewed By: jeroen.dobbelaere - -Differential Revision: https://reviews.llvm.org/D91576 - -(cherry picked from commit 18603319321a6c1b158800bcc60035ee01549516) ---- - llvm/include/llvm/Analysis/ScopedNoAliasAA.h | 21 ++++++++++ - llvm/lib/Analysis/ScopedNoAliasAA.cpp | 25 ------------ - llvm/lib/IR/Metadata.cpp | 28 ++++++++++++- - .../ScopedNoAliasAA/alias-scope-merging.ll | 37 ++++++++++++++++++ - llvm/test/Transforms/GVN/noalias.ll | 29 +++++++------- - .../InstCombine/fold-phi-load-metadata.ll | 4 +- - .../Transforms/MemCpyOpt/callslot_badaa.ll | 39 +++++++++++++++++++ - llvm/test/Transforms/NewGVN/noalias.ll | 29 +++++++------- - 8 files changed, 156 insertions(+), 56 deletions(-) - create mode 100644 llvm/test/Analysis/ScopedNoAliasAA/alias-scope-merging.ll - create mode 100644 llvm/test/Transforms/MemCpyOpt/callslot_badaa.ll - -diff --git a/llvm/include/llvm/Analysis/ScopedNoAliasAA.h b/llvm/include/llvm/Analysis/ScopedNoAliasAA.h -index c55228eace4b..562640647918 100644 ---- a/llvm/include/llvm/Analysis/ScopedNoAliasAA.h -+++ b/llvm/include/llvm/Analysis/ScopedNoAliasAA.h -@@ -25,6 +25,27 @@ class Function; - class MDNode; - class MemoryLocation; - -+/// This is a simple wrapper around an MDNode which provides a higher-level -+/// interface by hiding the details of how alias analysis information is encoded -+/// in its operands. -+class AliasScopeNode { -+ const MDNode *Node = nullptr; -+ -+public: -+ AliasScopeNode() = default; -+ explicit AliasScopeNode(const MDNode *N) : Node(N) {} -+ -+ /// Get the MDNode for this AliasScopeNode. -+ const MDNode *getNode() const { return Node; } -+ -+ /// Get the MDNode for this AliasScopeNode's domain. -+ const MDNode *getDomain() const { -+ if (Node->getNumOperands() < 2) -+ return nullptr; -+ return dyn_cast_or_null(Node->getOperand(1)); -+ } -+}; -+ - /// A simple AA result which uses scoped-noalias metadata to answer queries. - class ScopedNoAliasAAResult : public AAResultBase { - friend AAResultBase; -diff --git a/llvm/lib/Analysis/ScopedNoAliasAA.cpp b/llvm/lib/Analysis/ScopedNoAliasAA.cpp -index 8928678d6ab2..22e0501b28f4 100644 ---- a/llvm/lib/Analysis/ScopedNoAliasAA.cpp -+++ b/llvm/lib/Analysis/ScopedNoAliasAA.cpp -@@ -50,31 +50,6 @@ using namespace llvm; - static cl::opt EnableScopedNoAlias("enable-scoped-noalias", - cl::init(true), cl::Hidden); - --namespace { -- --/// This is a simple wrapper around an MDNode which provides a higher-level --/// interface by hiding the details of how alias analysis information is encoded --/// in its operands. --class AliasScopeNode { -- const MDNode *Node = nullptr; -- --public: -- AliasScopeNode() = default; -- explicit AliasScopeNode(const MDNode *N) : Node(N) {} -- -- /// Get the MDNode for this AliasScopeNode. -- const MDNode *getNode() const { return Node; } -- -- /// Get the MDNode for this AliasScopeNode's domain. -- const MDNode *getDomain() const { -- if (Node->getNumOperands() < 2) -- return nullptr; -- return dyn_cast_or_null(Node->getOperand(1)); -- } --}; -- --} // end anonymous namespace -- - AliasResult ScopedNoAliasAAResult::alias(const MemoryLocation &LocA, - const MemoryLocation &LocB, - AAQueryInfo &AAQI) { -diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp -index ce89009e86eb..5826464206d6 100644 ---- a/llvm/lib/IR/Metadata.cpp -+++ b/llvm/lib/IR/Metadata.cpp -@@ -26,6 +26,7 @@ - #include "llvm/ADT/StringMap.h" - #include "llvm/ADT/StringRef.h" - #include "llvm/ADT/Twine.h" -+#include "llvm/Analysis/ScopedNoAliasAA.h" - #include "llvm/IR/Argument.h" - #include "llvm/IR/BasicBlock.h" - #include "llvm/IR/Constant.h" -@@ -925,7 +926,32 @@ MDNode *MDNode::getMostGenericAliasScope(MDNode *A, MDNode *B) { - if (!A || !B) - return nullptr; - -- return concatenate(A, B); -+ // Take the intersection of domains then union the scopes -+ // within those domains -+ SmallPtrSet ADomains; -+ SmallPtrSet IntersectDomains; -+ SmallSetVector MDs; -+ for (const MDOperand &MDOp : A->operands()) -+ if (const MDNode *NAMD = dyn_cast(MDOp)) -+ if (const MDNode *Domain = AliasScopeNode(NAMD).getDomain()) -+ ADomains.insert(Domain); -+ -+ for (const MDOperand &MDOp : B->operands()) -+ if (const MDNode *NAMD = dyn_cast(MDOp)) -+ if (const MDNode *Domain = AliasScopeNode(NAMD).getDomain()) -+ if (ADomains.contains(Domain)) { -+ IntersectDomains.insert(Domain); -+ MDs.insert(MDOp); -+ } -+ -+ for (const MDOperand &MDOp : A->operands()) -+ if (const MDNode *NAMD = dyn_cast(MDOp)) -+ if (const MDNode *Domain = AliasScopeNode(NAMD).getDomain()) -+ if (IntersectDomains.contains(Domain)) -+ MDs.insert(MDOp); -+ -+ return MDs.empty() ? nullptr -+ : getOrSelfReference(A->getContext(), MDs.getArrayRef()); - } - - MDNode *MDNode::getMostGenericFPMath(MDNode *A, MDNode *B) { -diff --git a/llvm/test/Analysis/ScopedNoAliasAA/alias-scope-merging.ll b/llvm/test/Analysis/ScopedNoAliasAA/alias-scope-merging.ll -new file mode 100644 -index 000000000000..4c8369d30adb ---- /dev/null -+++ b/llvm/test/Analysis/ScopedNoAliasAA/alias-scope-merging.ll -@@ -0,0 +1,37 @@ -+; RUN: opt < %s -S -memcpyopt | FileCheck --match-full-lines %s -+ -+; Alias scopes are merged by taking the intersection of domains, then the union of the scopes within those domains -+define i8 @test(i8 %input) { -+ %tmp = alloca i8 -+ %dst = alloca i8 -+ %src = alloca i8 -+; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %src, i64 1, i1 false), !alias.scope ![[SCOPE:[0-9]+]] -+ call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %src), !noalias !4 -+ store i8 %input, i8* %src -+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %tmp, i8* align 8 %src, i64 1, i1 false), !alias.scope !0 -+ call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %src), !noalias !4 -+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %tmp, i64 1, i1 false), !alias.scope !4 -+ %ret_value = load i8, i8* %dst -+ ret i8 %ret_value -+} -+ -+; Merged scope contains "callee0: %a" and "callee0 : %b" -+; CHECK-DAG: ![[CALLEE0_A:[0-9]+]] = distinct !{!{{[0-9]+}}, !{{[0-9]+}}, !"callee0: %a"} -+; CHECK-DAG: ![[CALLEE0_B:[0-9]+]] = distinct !{!{{[0-9]+}}, !{{[0-9]+}}, !"callee0: %b"} -+; CHECK-DAG: ![[SCOPE]] = !{![[CALLEE0_A]], ![[CALLEE0_B]]} -+ -+declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) -+declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) -+declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i1) -+ -+!0 = !{!1, !7} -+!1 = distinct !{!1, !3, !"callee0: %a"} -+!2 = distinct !{!2, !3, !"callee0: %b"} -+!3 = distinct !{!3, !"callee0"} -+ -+!4 = !{!2, !5} -+!5 = distinct !{!5, !6, !"callee1: %a"} -+!6 = distinct !{!6, !"callee1"} -+ -+!7 = distinct !{!7, !8, !"callee2: %a"} -+!8 = distinct !{!8, !"callee2"} -diff --git a/llvm/test/Transforms/GVN/noalias.ll b/llvm/test/Transforms/GVN/noalias.ll -index 69c21f110b5e..67d48d768a91 100644 ---- a/llvm/test/Transforms/GVN/noalias.ll -+++ b/llvm/test/Transforms/GVN/noalias.ll -@@ -5,7 +5,7 @@ define i32 @test1(i32* %p, i32* %q) { - ; CHECK: load i32, i32* %p - ; CHECK-NOT: noalias - ; CHECK: %c = add i32 %a, %a -- %a = load i32, i32* %p, !noalias !0 -+ %a = load i32, i32* %p, !noalias !3 - %b = load i32, i32* %p - %c = add i32 %a, %b - ret i32 %c -@@ -13,31 +13,32 @@ define i32 @test1(i32* %p, i32* %q) { - - define i32 @test2(i32* %p, i32* %q) { - ; CHECK-LABEL: @test2(i32* %p, i32* %q) --; CHECK: load i32, i32* %p, align 4, !alias.scope !0 -+; CHECK: load i32, i32* %p, align 4, !alias.scope ![[SCOPE1:[0-9]+]] - ; CHECK: %c = add i32 %a, %a -- %a = load i32, i32* %p, !alias.scope !0 -- %b = load i32, i32* %p, !alias.scope !0 -+ %a = load i32, i32* %p, !alias.scope !3 -+ %b = load i32, i32* %p, !alias.scope !3 - %c = add i32 %a, %b - ret i32 %c - } - --; FIXME: In this case we can do better than intersecting the scopes, and can --; concatenate them instead. Both loads are in the same basic block, the first --; makes the second safe to speculatively execute, and there are no calls that may --; throw in between. - define i32 @test3(i32* %p, i32* %q) { - ; CHECK-LABEL: @test3(i32* %p, i32* %q) --; CHECK: load i32, i32* %p, align 4, !alias.scope !1 -+; CHECK: load i32, i32* %p, align 4, !alias.scope ![[SCOPE2:[0-9]+]] - ; CHECK: %c = add i32 %a, %a -- %a = load i32, i32* %p, !alias.scope !1 -- %b = load i32, i32* %p, !alias.scope !2 -+ %a = load i32, i32* %p, !alias.scope !4 -+ %b = load i32, i32* %p, !alias.scope !5 - %c = add i32 %a, %b - ret i32 %c - } - -+; CHECK: ![[SCOPE1]] = !{!{{[0-9]+}}} -+; CHECK: ![[SCOPE2]] = !{!{{[0-9]+}}, !{{[0-9]+}}} - declare i32 @foo(i32*) readonly - --!0 = !{!0} --!1 = !{!1} --!2 = !{!0, !1} -+!0 = distinct !{!0, !2, !"callee0: %a"} -+!1 = distinct !{!1, !2, !"callee0: %b"} -+!2 = distinct !{!2, !"callee0"} - -+!3 = !{!0} -+!4 = !{!1} -+!5 = !{!0, !1} -diff --git a/llvm/test/Transforms/InstCombine/fold-phi-load-metadata.ll b/llvm/test/Transforms/InstCombine/fold-phi-load-metadata.ll -index e5a1aa7362a5..7fa26b46e25d 100644 ---- a/llvm/test/Transforms/InstCombine/fold-phi-load-metadata.ll -+++ b/llvm/test/Transforms/InstCombine/fold-phi-load-metadata.ll -@@ -40,10 +40,10 @@ return: ; preds = %if.end, %if.then - ; CHECK: ![[TBAA]] = !{![[TAG1:[0-9]+]], ![[TAG1]], i64 0} - ; CHECK: ![[TAG1]] = !{!"int", !{{[0-9]+}}, i64 0} - ; CHECK: ![[RANGE]] = !{i32 10, i32 25} --; CHECK: ![[ALIAS_SCOPE]] = !{![[SCOPE0:[0-9]+]], ![[SCOPE2:[0-9]+]], ![[SCOPE1:[0-9]+]]} -+; CHECK: ![[ALIAS_SCOPE]] = !{![[SCOPE0:[0-9]+]], ![[SCOPE1:[0-9]+]], ![[SCOPE2:[0-9]+]]} - ; CHECK: ![[SCOPE0]] = distinct !{![[SCOPE0]], !{{[0-9]+}}, !"scope0"} --; CHECK: ![[SCOPE2]] = distinct !{![[SCOPE2]], !{{[0-9]+}}, !"scope2"} - ; CHECK: ![[SCOPE1]] = distinct !{![[SCOPE1]], !{{[0-9]+}}, !"scope1"} -+; CHECK: ![[SCOPE2]] = distinct !{![[SCOPE2]], !{{[0-9]+}}, !"scope2"} - ; CHECK: ![[NOALIAS]] = !{![[SCOPE3:[0-9]+]]} - ; CHECK: ![[SCOPE3]] = distinct !{![[SCOPE3]], !{{[0-9]+}}, !"scope3"} - -diff --git a/llvm/test/Transforms/MemCpyOpt/callslot_badaa.ll b/llvm/test/Transforms/MemCpyOpt/callslot_badaa.ll -new file mode 100644 -index 000000000000..346546f72c4c ---- /dev/null -+++ b/llvm/test/Transforms/MemCpyOpt/callslot_badaa.ll -@@ -0,0 +1,39 @@ -+; RUN: opt < %s -S -memcpyopt | FileCheck --match-full-lines %s -+ -+; Make sure callslot optimization merges alias.scope metadata correctly when it merges instructions. -+; Merging here naively generates: -+; call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %src, i64 1, i1 false), !alias.scope !3 -+; call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %src), !noalias !0 -+; ... -+; !0 = !{!1} -+; !1 = distinct !{!1, !2, !"callee1: %a"} -+; !2 = distinct !{!2, !"callee1"} -+; !3 = !{!1, !4} -+; !4 = distinct !{!4, !5, !"callee0: %a"} -+; !5 = distinct !{!5, !"callee0"} -+; Which is incorrect because the lifetime.end of %src will now "noalias" the above memcpy. -+define i8 @test(i8 %input) { -+ %tmp = alloca i8 -+ %dst = alloca i8 -+ %src = alloca i8 -+; NOTE: we're matching the full line and looking for the lack of !alias.scope here -+; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %src, i64 1, i1 false) -+ call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %src), !noalias !3 -+ store i8 %input, i8* %src -+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %tmp, i8* align 8 %src, i64 1, i1 false), !alias.scope !0 -+ call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %src), !noalias !3 -+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %dst, i8* align 8 %tmp, i64 1, i1 false), !alias.scope !3 -+ %ret_value = load i8, i8* %dst -+ ret i8 %ret_value -+} -+ -+declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) -+declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) -+declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i1) -+ -+!0 = !{!1} -+!1 = distinct !{!1, !2, !"callee0: %a"} -+!2 = distinct !{!2, !"callee0"} -+!3 = !{!4} -+!4 = distinct !{!4, !5, !"callee1: %a"} -+!5 = distinct !{!5, !"callee1"} -diff --git a/llvm/test/Transforms/NewGVN/noalias.ll b/llvm/test/Transforms/NewGVN/noalias.ll -index c5f23bfad89a..2d90dc84d90b 100644 ---- a/llvm/test/Transforms/NewGVN/noalias.ll -+++ b/llvm/test/Transforms/NewGVN/noalias.ll -@@ -5,7 +5,7 @@ define i32 @test1(i32* %p, i32* %q) { - ; CHECK: load i32, i32* %p - ; CHECK-NOT: noalias - ; CHECK: %c = add i32 %a, %a -- %a = load i32, i32* %p, !noalias !0 -+ %a = load i32, i32* %p, !noalias !3 - %b = load i32, i32* %p - %c = add i32 %a, %b - ret i32 %c -@@ -13,31 +13,32 @@ define i32 @test1(i32* %p, i32* %q) { - - define i32 @test2(i32* %p, i32* %q) { - ; CHECK-LABEL: @test2(i32* %p, i32* %q) --; CHECK: load i32, i32* %p, align 4, !alias.scope !0 -+; CHECK: load i32, i32* %p, align 4, !alias.scope ![[SCOPE1:[0-9]+]] - ; CHECK: %c = add i32 %a, %a -- %a = load i32, i32* %p, !alias.scope !0 -- %b = load i32, i32* %p, !alias.scope !0 -+ %a = load i32, i32* %p, !alias.scope !3 -+ %b = load i32, i32* %p, !alias.scope !3 - %c = add i32 %a, %b - ret i32 %c - } - --; FIXME: In this case we can do better than intersecting the scopes, and can --; concatenate them instead. Both loads are in the same basic block, the first --; makes the second safe to speculatively execute, and there are no calls that may --; throw in between. - define i32 @test3(i32* %p, i32* %q) { - ; CHECK-LABEL: @test3(i32* %p, i32* %q) --; CHECK: load i32, i32* %p, align 4, !alias.scope !1 -+; CHECK: load i32, i32* %p, align 4, !alias.scope ![[SCOPE2:[0-9]+]] - ; CHECK: %c = add i32 %a, %a -- %a = load i32, i32* %p, !alias.scope !1 -- %b = load i32, i32* %p, !alias.scope !2 -+ %a = load i32, i32* %p, !alias.scope !4 -+ %b = load i32, i32* %p, !alias.scope !5 - %c = add i32 %a, %b - ret i32 %c - } - -+; CHECK: ![[SCOPE1]] = !{!{{[0-9]+}}} -+; CHECK: ![[SCOPE2]] = !{!{{[0-9]+}}, !{{[0-9]+}}} - declare i32 @foo(i32*) readonly - --!0 = !{!0} --!1 = !{!1} --!2 = !{!0, !1} -+!0 = distinct !{!0, !2, !"callee0: %a"} -+!1 = distinct !{!1, !2, !"callee0: %b"} -+!2 = distinct !{!2, !"callee0"} - -+!3 = !{!0} -+!4 = !{!1} -+!5 = !{!0, !1} --- -2.30.2 - diff --git a/SOURCES/0001-PATCH-clang-Reorganize-gtest-integration.patch b/SOURCES/0001-PATCH-clang-Reorganize-gtest-integration.patch new file mode 100644 index 0000000..673215a --- /dev/null +++ b/SOURCES/0001-PATCH-clang-Reorganize-gtest-integration.patch @@ -0,0 +1,42 @@ +From c6b921c8d833546946b70a8c2640032fd7c62461 Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Thu, 25 Feb 2021 14:04:52 +0100 +Subject: [PATCH 1/6] [PATCH][clang] Reorganize gtest integration + +--- + CMakeLists.txt | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9e74014..0185276 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -153,12 +153,6 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) + set(LLVM_UTILS_PROVIDED ON) + set(CLANG_TEST_DEPS FileCheck count not) + endif() +- set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest) +- if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h +- AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} +- AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt) +- add_subdirectory(${UNITTEST_DIR} utils/unittest) +- endif() + else() + # Seek installed Lit. + find_program(LLVM_LIT +@@ -537,7 +531,11 @@ endif() + + + if( CLANG_INCLUDE_TESTS ) +- if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h) ++ set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest) ++ if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h ++ AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} ++ AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt) ++ add_subdirectory(${UNITTEST_DIR} utils/unittest) + add_subdirectory(unittests) + list(APPEND CLANG_TEST_DEPS ClangUnitTests) + list(APPEND CLANG_TEST_PARAMS +-- +1.8.3.1 + diff --git a/SOURCES/0001-Partially-Revert-scan-view-Remove-Reporter.py-and-as.patch b/SOURCES/0001-Partially-Revert-scan-view-Remove-Reporter.py-and-as.patch deleted file mode 100644 index 6c1d6e0..0000000 --- a/SOURCES/0001-Partially-Revert-scan-view-Remove-Reporter.py-and-as.patch +++ /dev/null @@ -1,224 +0,0 @@ -From 9d68d4554d903353a7d4599d2428bd479651eb40 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Tue, 9 Feb 2021 13:35:43 -0800 -Subject: [PATCH] Partially Revert "scan-view: Remove Reporter.py and - associated AppleScript files" - -This reverts some of commit dbb01536f6f49fa428f170e34466072ef439b3e9. - -The Reporter module was still being used by the ScanView.py module and deleting -it caused scan-view to fail. This commit adds back Reporter.py but removes the -code the references the AppleScript files which were removed in -dbb01536f6f49fa428f170e34466072ef439b3e9. - -Differential Revision: https://reviews.llvm.org/D96367 ---- - clang/tools/scan-view/CMakeLists.txt | 1 + - clang/tools/scan-view/share/Reporter.py | 183 ++++++++++++++++++++++++ - 2 files changed, 184 insertions(+) - create mode 100644 clang/tools/scan-view/share/Reporter.py - -diff --git clang-a/tools/scan-view/CMakeLists.txt clang-b/tools/scan-view/CMakeLists.txt -index dd3d33439299..eccc6b83195b 100644 ---- clang-a/tools/scan-view/CMakeLists.txt -+++ clang-b/tools/scan-view/CMakeLists.txt -@@ -5,6 +5,7 @@ set(BinFiles - - set(ShareFiles - ScanView.py -+ Reporter.py - startfile.py - bugcatcher.ico) - -diff --git clang-a/tools/scan-view/share/Reporter.py clang-b/tools/scan-view/share/Reporter.py -new file mode 100644 -index 000000000000..31a14fb0cf74 ---- /dev/null -+++ clang-b/tools/scan-view/share/Reporter.py -@@ -0,0 +1,183 @@ -+#!/usr/bin/env python -+# -*- coding: utf-8 -*- -+ -+"""Methods for reporting bugs.""" -+ -+import subprocess, sys, os -+ -+__all__ = ['ReportFailure', 'BugReport', 'getReporters'] -+ -+# -+ -+class ReportFailure(Exception): -+ """Generic exception for failures in bug reporting.""" -+ def __init__(self, value): -+ self.value = value -+ -+# Collect information about a bug. -+ -+class BugReport(object): -+ def __init__(self, title, description, files): -+ self.title = title -+ self.description = description -+ self.files = files -+ -+# Reporter interfaces. -+ -+import os -+ -+import email, mimetypes, smtplib -+from email import encoders -+from email.message import Message -+from email.mime.base import MIMEBase -+from email.mime.multipart import MIMEMultipart -+from email.mime.text import MIMEText -+ -+#===------------------------------------------------------------------------===# -+# ReporterParameter -+#===------------------------------------------------------------------------===# -+ -+class ReporterParameter(object): -+ def __init__(self, n): -+ self.name = n -+ def getName(self): -+ return self.name -+ def getValue(self,r,bugtype,getConfigOption): -+ return getConfigOption(r.getName(),self.getName()) -+ def saveConfigValue(self): -+ return True -+ -+class TextParameter (ReporterParameter): -+ def getHTML(self,r,bugtype,getConfigOption): -+ return """\ -+ -+%s: -+ -+"""%(self.getName(),r.getName(),self.getName(),self.getValue(r,bugtype,getConfigOption)) -+ -+class SelectionParameter (ReporterParameter): -+ def __init__(self, n, values): -+ ReporterParameter.__init__(self,n) -+ self.values = values -+ -+ def getHTML(self,r,bugtype,getConfigOption): -+ default = self.getValue(r,bugtype,getConfigOption) -+ return """\ -+ -+%s:"""%(self.getName(),r.getName(),self.getName(),'\n'.join(["""\ -+"""%(o[0], -+ o[0] == default and ' selected="selected"' or '', -+ o[1]) for o in self.values])) -+ -+#===------------------------------------------------------------------------===# -+# Reporters -+#===------------------------------------------------------------------------===# -+ -+class EmailReporter(object): -+ def getName(self): -+ return 'Email' -+ -+ def getParameters(self): -+ return [TextParameter(x) for x in ['To', 'From', 'SMTP Server', 'SMTP Port']] -+ -+ # Lifted from python email module examples. -+ def attachFile(self, outer, path): -+ # Guess the content type based on the file's extension. Encoding -+ # will be ignored, although we should check for simple things like -+ # gzip'd or compressed files. -+ ctype, encoding = mimetypes.guess_type(path) -+ if ctype is None or encoding is not None: -+ # No guess could be made, or the file is encoded (compressed), so -+ # use a generic bag-of-bits type. -+ ctype = 'application/octet-stream' -+ maintype, subtype = ctype.split('/', 1) -+ if maintype == 'text': -+ fp = open(path) -+ # Note: we should handle calculating the charset -+ msg = MIMEText(fp.read(), _subtype=subtype) -+ fp.close() -+ else: -+ fp = open(path, 'rb') -+ msg = MIMEBase(maintype, subtype) -+ msg.set_payload(fp.read()) -+ fp.close() -+ # Encode the payload using Base64 -+ encoders.encode_base64(msg) -+ # Set the filename parameter -+ msg.add_header('Content-Disposition', 'attachment', filename=os.path.basename(path)) -+ outer.attach(msg) -+ -+ def fileReport(self, report, parameters): -+ mainMsg = """\ -+BUG REPORT -+--- -+Title: %s -+Description: %s -+"""%(report.title, report.description) -+ -+ if not parameters.get('To'): -+ raise ReportFailure('No "To" address specified.') -+ if not parameters.get('From'): -+ raise ReportFailure('No "From" address specified.') -+ -+ msg = MIMEMultipart() -+ msg['Subject'] = 'BUG REPORT: %s'%(report.title) -+ # FIXME: Get config parameters -+ msg['To'] = parameters.get('To') -+ msg['From'] = parameters.get('From') -+ msg.preamble = mainMsg -+ -+ msg.attach(MIMEText(mainMsg, _subtype='text/plain')) -+ for file in report.files: -+ self.attachFile(msg, file) -+ -+ try: -+ s = smtplib.SMTP(host=parameters.get('SMTP Server'), -+ port=parameters.get('SMTP Port')) -+ s.sendmail(msg['From'], msg['To'], msg.as_string()) -+ s.close() -+ except: -+ raise ReportFailure('Unable to send message via SMTP.') -+ -+ return "Message sent!" -+ -+class BugzillaReporter(object): -+ def getName(self): -+ return 'Bugzilla' -+ -+ def getParameters(self): -+ return [TextParameter(x) for x in ['URL','Product']] -+ -+ def fileReport(self, report, parameters): -+ raise NotImplementedError -+ -+ -+class RadarClassificationParameter(SelectionParameter): -+ def __init__(self): -+ SelectionParameter.__init__(self,"Classification", -+ [['1', 'Security'], ['2', 'Crash/Hang/Data Loss'], -+ ['3', 'Performance'], ['4', 'UI/Usability'], -+ ['6', 'Serious Bug'], ['7', 'Other']]) -+ -+ def saveConfigValue(self): -+ return False -+ -+ def getValue(self,r,bugtype,getConfigOption): -+ if bugtype.find("leak") != -1: -+ return '3' -+ elif bugtype.find("dereference") != -1: -+ return '2' -+ elif bugtype.find("missing ivar release") != -1: -+ return '3' -+ else: -+ return '7' -+ -+### -+ -+def getReporters(): -+ reporters = [] -+ reporters.append(EmailReporter()) -+ return reporters -+ --- -2.27.0 - diff --git a/SOURCES/0001-SystemZ-Assign-the-full-space-for-promoted-and-split.patch b/SOURCES/0001-SystemZ-Assign-the-full-space-for-promoted-and-split.patch deleted file mode 100644 index db1b5e2..0000000 --- a/SOURCES/0001-SystemZ-Assign-the-full-space-for-promoted-and-split.patch +++ /dev/null @@ -1,157 +0,0 @@ -From c6f9d6db7b0c4677d1aae8977505fe6340a3aae2 Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Wed, 10 Mar 2021 15:52:27 -0800 -Subject: [PATCH] [SystemZ] Assign the full space for promoted and split - outgoing args. (#95) - -When a large "irregular" (e.g. i96) integer call argument is converted to -indirect, 64-bit parts are stored to the stack. The full stack space -(e.g. i128) was not allocated prior to this patch, but rather just the exact -space of the original type. This caused neighboring values on the stack to be -overwritten. - -Thanks to Josh Stone for reporting this. - -Review: Ulrich Weigand -Fixes https://bugs.llvm.org/show_bug.cgi?id=49322 -Differential Revision: https://reviews.llvm.org/D97514 - -(cherry picked from commit 52bbbf4d4459239e0f461bc302ada89e2c5d07fc) - -Co-authored-by: Jonas Paulsson ---- - .../Target/SystemZ/SystemZISelLowering.cpp | 22 ++++++-- - llvm/test/CodeGen/SystemZ/args-11.ll | 54 +++++++++++++++++++ - 2 files changed, 72 insertions(+), 4 deletions(-) - create mode 100644 llvm/test/CodeGen/SystemZ/args-11.ll - -diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp -index eb1e51341ec4..faf7b3eaef3c 100644 ---- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp -+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp -@@ -1543,6 +1543,7 @@ SystemZTargetLowering::LowerCall(CallLoweringInfo &CLI, - bool IsVarArg = CLI.IsVarArg; - MachineFunction &MF = DAG.getMachineFunction(); - EVT PtrVT = getPointerTy(MF.getDataLayout()); -+ LLVMContext &Ctx = *DAG.getContext(); - - // Detect unsupported vector argument and return types. - if (Subtarget.hasVector()) { -@@ -1552,7 +1553,7 @@ SystemZTargetLowering::LowerCall(CallLoweringInfo &CLI, - - // Analyze the operands of the call, assigning locations to each operand. - SmallVector ArgLocs; -- SystemZCCState ArgCCInfo(CallConv, IsVarArg, MF, ArgLocs, *DAG.getContext()); -+ SystemZCCState ArgCCInfo(CallConv, IsVarArg, MF, ArgLocs, Ctx); - ArgCCInfo.AnalyzeCallOperands(Outs, CC_SystemZ); - - // We don't support GuaranteedTailCallOpt, only automatically-detected -@@ -1577,14 +1578,25 @@ SystemZTargetLowering::LowerCall(CallLoweringInfo &CLI, - - if (VA.getLocInfo() == CCValAssign::Indirect) { - // Store the argument in a stack slot and pass its address. -- SDValue SpillSlot = DAG.CreateStackTemporary(Outs[I].ArgVT); -+ unsigned ArgIndex = Outs[I].OrigArgIndex; -+ EVT SlotVT; -+ if (I + 1 != E && Outs[I + 1].OrigArgIndex == ArgIndex) { -+ // Allocate the full stack space for a promoted (and split) argument. -+ Type *OrigArgType = CLI.Args[Outs[I].OrigArgIndex].Ty; -+ EVT OrigArgVT = getValueType(MF.getDataLayout(), OrigArgType); -+ MVT PartVT = getRegisterTypeForCallingConv(Ctx, CLI.CallConv, OrigArgVT); -+ unsigned N = getNumRegistersForCallingConv(Ctx, CLI.CallConv, OrigArgVT); -+ SlotVT = EVT::getIntegerVT(Ctx, PartVT.getSizeInBits() * N); -+ } else { -+ SlotVT = Outs[I].ArgVT; -+ } -+ SDValue SpillSlot = DAG.CreateStackTemporary(SlotVT); - int FI = cast(SpillSlot)->getIndex(); - MemOpChains.push_back( - DAG.getStore(Chain, DL, ArgValue, SpillSlot, - MachinePointerInfo::getFixedStack(MF, FI))); - // If the original argument was split (e.g. i128), we need - // to store all parts of it here (and pass just one address). -- unsigned ArgIndex = Outs[I].OrigArgIndex; - assert (Outs[I].PartOffset == 0); - while (I + 1 != E && Outs[I + 1].OrigArgIndex == ArgIndex) { - SDValue PartValue = OutVals[I + 1]; -@@ -1594,6 +1606,8 @@ SystemZTargetLowering::LowerCall(CallLoweringInfo &CLI, - MemOpChains.push_back( - DAG.getStore(Chain, DL, PartValue, Address, - MachinePointerInfo::getFixedStack(MF, FI))); -+ assert((PartOffset + PartValue.getValueType().getStoreSize() <= -+ SlotVT.getStoreSize()) && "Not enough space for argument part!"); - ++I; - } - ArgValue = SpillSlot; -@@ -1687,7 +1701,7 @@ SystemZTargetLowering::LowerCall(CallLoweringInfo &CLI, - - // Assign locations to each value returned by this call. - SmallVector RetLocs; -- CCState RetCCInfo(CallConv, IsVarArg, MF, RetLocs, *DAG.getContext()); -+ CCState RetCCInfo(CallConv, IsVarArg, MF, RetLocs, Ctx); - RetCCInfo.AnalyzeCallResult(Ins, RetCC_SystemZ); - - // Copy all of the result registers out of their specified physreg. -diff --git a/llvm/test/CodeGen/SystemZ/args-11.ll b/llvm/test/CodeGen/SystemZ/args-11.ll -new file mode 100644 -index 000000000000..b355f9d6da15 ---- /dev/null -+++ b/llvm/test/CodeGen/SystemZ/args-11.ll -@@ -0,0 +1,54 @@ -+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -+; Test outgoing promoted arguments that are split (and passed by reference). -+; -+; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s -+ -+; The i96 arg is promoted to i128 and should get the full stack space. -+declare void @fn1(i96) -+define i32 @fn2() { -+; CHECK-LABEL: fn2: -+; CHECK: # %bb.0: -+; CHECK-NEXT: stmg %r14, %r15, 112(%r15) -+; CHECK-NEXT: .cfi_offset %r14, -48 -+; CHECK-NEXT: .cfi_offset %r15, -40 -+; CHECK-NEXT: aghi %r15, -184 -+; CHECK-NEXT: .cfi_def_cfa_offset 344 -+; CHECK-NEXT: mvhi 180(%r15), -1 -+; CHECK-NEXT: mvghi 168(%r15), 0 -+; CHECK-NEXT: la %r2, 160(%r15) -+; CHECK-NEXT: mvghi 160(%r15), 0 -+; CHECK-NEXT: brasl %r14, fn1@PLT -+; CHECK-NEXT: l %r2, 180(%r15) -+; CHECK-NEXT: lmg %r14, %r15, 296(%r15) -+; CHECK-NEXT: br %r14 -+ %1 = alloca i32 -+ store i32 -1, i32* %1 -+ call void @fn1(i96 0) -+ %2 = load i32, i32* %1 -+ ret i32 %2 -+} -+ -+declare void @fn3(i136) -+define i32 @fn4() { -+; CHECK-LABEL: fn4: -+; CHECK: # %bb.0: -+; CHECK-NEXT: stmg %r14, %r15, 112(%r15) -+; CHECK-NEXT: .cfi_offset %r14, -48 -+; CHECK-NEXT: .cfi_offset %r15, -40 -+; CHECK-NEXT: aghi %r15, -192 -+; CHECK-NEXT: .cfi_def_cfa_offset 352 -+; CHECK-NEXT: mvhi 188(%r15), -1 -+; CHECK-NEXT: mvghi 176(%r15), 0 -+; CHECK-NEXT: mvghi 168(%r15), 0 -+; CHECK-NEXT: la %r2, 160(%r15) -+; CHECK-NEXT: mvghi 160(%r15), 0 -+; CHECK-NEXT: brasl %r14, fn3@PLT -+; CHECK-NEXT: l %r2, 188(%r15) -+; CHECK-NEXT: lmg %r14, %r15, 304(%r15) -+; CHECK-NEXT: br %r14 -+ %1 = alloca i32 -+ store i32 -1, i32* %1 -+ call void @fn3(i136 0) -+ %2 = load i32, i32* %1 -+ ret i32 %2 -+} --- -2.30.2 - diff --git a/SOURCES/0001-SystemZ-Use-LA-instead-of-AGR-in-eliminateFrameIndex.patch b/SOURCES/0001-SystemZ-Use-LA-instead-of-AGR-in-eliminateFrameIndex.patch deleted file mode 100644 index 80d6a1e..0000000 --- a/SOURCES/0001-SystemZ-Use-LA-instead-of-AGR-in-eliminateFrameIndex.patch +++ /dev/null @@ -1,166 +0,0 @@ -From d851495f2fe614c4c860bda1bd3c80bfbe48360b Mon Sep 17 00:00:00 2001 -From: Jonas Paulsson -Date: Thu, 8 Oct 2020 13:18:29 +0200 -Subject: [PATCH] [SystemZ] Use LA instead of AGR in eliminateFrameIndex(). - -Since AGR clobbers CC it should not be used here. - -Fixes https://bugs.llvm.org/show_bug.cgi?id=47736. - -Review: Ulrich Weigand -Differential Revision: https://reviews.llvm.org/D89034 ---- - .../Target/SystemZ/SystemZRegisterInfo.cpp | 4 +-- - llvm/test/CodeGen/SystemZ/frame-14.ll | 26 +++++++++---------- - llvm/test/CodeGen/SystemZ/frame-16.ll | 4 +-- - 3 files changed, 17 insertions(+), 17 deletions(-) - -diff --git a/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp b/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp -index 53b06c6e7e6d..88212e52460f 100644 ---- a/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp -+++ b/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp -@@ -322,8 +322,8 @@ SystemZRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator MI, - // Load the high offset into the scratch register and use it as - // an index. - TII->loadImmediate(MBB, MI, ScratchReg, HighOffset); -- BuildMI(MBB, MI, DL, TII->get(SystemZ::AGR),ScratchReg) -- .addReg(ScratchReg, RegState::Kill).addReg(BasePtr); -+ BuildMI(MBB, MI, DL, TII->get(SystemZ::LA), ScratchReg) -+ .addReg(BasePtr, RegState::Kill).addImm(0).addReg(ScratchReg); - } - - // Use the scratch register as the base. It then dies here. -diff --git a/llvm/test/CodeGen/SystemZ/frame-14.ll b/llvm/test/CodeGen/SystemZ/frame-14.ll -index e70731249b42..193ff81123c5 100644 ---- a/llvm/test/CodeGen/SystemZ/frame-14.ll -+++ b/llvm/test/CodeGen/SystemZ/frame-14.ll -@@ -85,13 +85,13 @@ define void @f3() { - define void @f4() { - ; CHECK-NOFP-LABEL: f4: - ; CHECK-NOFP: llilh %r1, 8 --; CHECK-NOFP: agr %r1, %r15 -+; CHECK-NOFP: la %r1, 0(%r1,%r15) - ; CHECK-NOFP: mvi 0(%r1), 42 - ; CHECK-NOFP: br %r14 - ; - ; CHECK-FP-LABEL: f4: - ; CHECK-FP: llilh %r1, 8 --; CHECK-FP: agr %r1, %r11 -+; CHECK-FP: la %r1, 0(%r1,%r11) - ; CHECK-FP: mvi 0(%r1), 42 - ; CHECK-FP: br %r14 - %region1 = alloca [524104 x i8], align 8 -@@ -108,13 +108,13 @@ define void @f4() { - define void @f5() { - ; CHECK-NOFP-LABEL: f5: - ; CHECK-NOFP: llilh %r1, 8 --; CHECK-NOFP: agr %r1, %r15 -+; CHECK-NOFP: la %r1, 0(%r1,%r15) - ; CHECK-NOFP: mvi 4095(%r1), 42 - ; CHECK-NOFP: br %r14 - ; - ; CHECK-FP-LABEL: f5: - ; CHECK-FP: llilh %r1, 8 --; CHECK-FP: agr %r1, %r11 -+; CHECK-FP: la %r1, 0(%r1,%r11) - ; CHECK-FP: mvi 4095(%r1), 42 - ; CHECK-FP: br %r14 - %region1 = alloca [524104 x i8], align 8 -@@ -130,13 +130,13 @@ define void @f5() { - define void @f6() { - ; CHECK-NOFP-LABEL: f6: - ; CHECK-NOFP: llilh %r1, 8 --; CHECK-NOFP: agr %r1, %r15 -+; CHECK-NOFP: la %r1, 0(%r1,%r15) - ; CHECK-NOFP: mviy 4096(%r1), 42 - ; CHECK-NOFP: br %r14 - ; - ; CHECK-FP-LABEL: f6: - ; CHECK-FP: llilh %r1, 8 --; CHECK-FP: agr %r1, %r11 -+; CHECK-FP: la %r1, 0(%r1,%r11) - ; CHECK-FP: mviy 4096(%r1), 42 - ; CHECK-FP: br %r14 - %region1 = alloca [524104 x i8], align 8 -@@ -155,13 +155,13 @@ define void @f6() { - define void @f7() { - ; CHECK-NOFP-LABEL: f7: - ; CHECK-NOFP: llilh %r1, 23 --; CHECK-NOFP: agr %r1, %r15 -+; CHECK-NOFP: la %r1, 0(%r1,%r15) - ; CHECK-NOFP: mviy 65535(%r1), 42 - ; CHECK-NOFP: br %r14 - ; - ; CHECK-FP-LABEL: f7: - ; CHECK-FP: llilh %r1, 23 --; CHECK-FP: agr %r1, %r11 -+; CHECK-FP: la %r1, 0(%r1,%r11) - ; CHECK-FP: mviy 65535(%r1), 42 - ; CHECK-FP: br %r14 - %region1 = alloca [1048400 x i8], align 8 -@@ -178,13 +178,13 @@ define void @f7() { - define void @f8() { - ; CHECK-NOFP-LABEL: f8: - ; CHECK-NOFP: llilh %r1, 24 --; CHECK-NOFP: agr %r1, %r15 -+; CHECK-NOFP: la %r1, 0(%r1,%r15) - ; CHECK-NOFP: mvi 7(%r1), 42 - ; CHECK-NOFP: br %r14 - ; - ; CHECK-FP-LABEL: f8: - ; CHECK-FP: llilh %r1, 24 --; CHECK-FP: agr %r1, %r11 -+; CHECK-FP: la %r1, 0(%r1,%r11) - ; CHECK-FP: mvi 7(%r1), 42 - ; CHECK-FP: br %r14 - %region1 = alloca [1048408 x i8], align 8 -@@ -233,7 +233,7 @@ define void @f10(i32 *%vptr) { - ; CHECK-NOFP-LABEL: f10: - ; CHECK-NOFP: stg [[REGISTER:%r[1-9][0-4]?]], [[OFFSET:160|168]](%r15) - ; CHECK-NOFP: llilh [[REGISTER]], 8 --; CHECK-NOFP: agr [[REGISTER]], %r15 -+; CHECK-NOFP: la [[REGISTER]], 0([[REGISTER]],%r15) - ; CHECK-NOFP: mvi 0([[REGISTER]]), 42 - ; CHECK-NOFP: lg [[REGISTER]], [[OFFSET]](%r15) - ; CHECK-NOFP: br %r14 -@@ -241,7 +241,7 @@ define void @f10(i32 *%vptr) { - ; CHECK-FP-LABEL: f10: - ; CHECK-FP: stg [[REGISTER:%r[1-9][0-4]?]], [[OFFSET:160|168]](%r11) - ; CHECK-FP: llilh [[REGISTER]], 8 --; CHECK-FP: agr [[REGISTER]], %r11 -+; CHECK-FP: la [[REGISTER]], 0([[REGISTER]],%r11) - ; CHECK-FP: mvi 0([[REGISTER]]), 42 - ; CHECK-FP: lg [[REGISTER]], [[OFFSET]](%r11) - ; CHECK-FP: br %r14 -@@ -273,7 +273,7 @@ define void @f11(i32 *%vptr) { - ; CHECK-NOFP: stmg %r6, %r15, - ; CHECK-NOFP: stg [[REGISTER:%r[1-9][0-4]?]], [[OFFSET:160|168]](%r15) - ; CHECK-NOFP: llilh [[REGISTER]], 8 --; CHECK-NOFP: agr [[REGISTER]], %r15 -+; CHECK-NOFP: la [[REGISTER]], 0([[REGISTER]],%r15) - ; CHECK-NOFP: mvi 0([[REGISTER]]), 42 - ; CHECK-NOFP: lg [[REGISTER]], [[OFFSET]](%r15) - ; CHECK-NOFP: lmg %r6, %r15, -diff --git a/llvm/test/CodeGen/SystemZ/frame-16.ll b/llvm/test/CodeGen/SystemZ/frame-16.ll -index ae8a041ae110..a95c58207afb 100644 ---- a/llvm/test/CodeGen/SystemZ/frame-16.ll -+++ b/llvm/test/CodeGen/SystemZ/frame-16.ll -@@ -311,13 +311,13 @@ define void @f11(i32 *%vptr, i8 %byte) { - define void @f12(i8 %byte, i64 %index) { - ; CHECK-NOFP-LABEL: f12: - ; CHECK-NOFP: llilh %r1, 8 --; CHECK-NOFP: agr %r1, %r15 -+; CHECK-NOFP: la %r1, 0(%r1,%r15) - ; CHECK-NOFP: stc %r2, 0(%r3,%r1) - ; CHECK-NOFP: br %r14 - ; - ; CHECK-FP-LABEL: f12: - ; CHECK-FP: llilh %r1, 8 --; CHECK-FP: agr %r1, %r11 -+; CHECK-FP: la %r1, 0(%r1,%r11) - ; CHECK-FP: stc %r2, 0(%r3,%r1) - ; CHECK-FP: br %r14 - %region1 = alloca [524104 x i8], align 8 --- -2.26.2 - diff --git a/SOURCES/0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch b/SOURCES/0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch deleted file mode 100644 index f4f0fa3..0000000 --- a/SOURCES/0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 09ae3ef5710a89505318ec721c65b6c838147276 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Thu, 7 Feb 2019 21:05:37 -0800 -Subject: [PATCH] ToolChain: Add -lgcc_s to the linker flags when using libc++ - -The libc++ build for Fedora does not include an implementation of -libunwind, so we need to explicitly link against something that -provides this implementation. ---- - clang/lib/Driver/ToolChain.cpp | 1 + - clang/test/Driver/netbsd.cpp | 4 ++-- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp -index 88a627e..cb99844 100644 ---- a/lib/Driver/ToolChain.cpp -+++ b/lib/Driver/ToolChain.cpp -@@ -767,6 +767,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args, - switch (Type) { - case ToolChain::CST_Libcxx: - CmdArgs.push_back("-lc++"); -+ CmdArgs.push_back("-lgcc_s"); - break; - - case ToolChain::CST_Libstdcxx: -diff --git a/test/Driver/netbsd.cpp b/test/Driver/netbsd.cpp -index 4af7d83..ff18c62 100644 ---- a/test/Driver/netbsd.cpp -+++ b/test/Driver/netbsd.cpp -@@ -131,7 +131,7 @@ - // ARM-7: clang{{.*}}" "-cc1" "-triple" "armv5e-unknown-netbsd7.0.0-eabi" - // ARM-7: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so" - // ARM-7: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}eabi{{/|\\\\}}crti.o" --// ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lm" "-lc" -+// ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lgcc_s" "-lm" "-lc" - // ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o" - - // AARCH64: clang{{.*}}" "-cc1" "-triple" "aarch64-unknown-netbsd" -@@ -250,7 +250,7 @@ - // S-ARM-7: clang{{.*}}" "-cc1" "-triple" "armv5e-unknown-netbsd7.0.0-eabi" - // S-ARM-7: ld{{.*}}" "--eh-frame-hdr" "-Bstatic" - // S-ARM-7: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}eabi{{/|\\\\}}crti.o" --// S-ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lm" "-lc" -+// S-ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lgcc_s" "-lm" "-lc" - // S-ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o" - - // S-AARCH64: clang{{.*}}" "-cc1" "-triple" "aarch64-unknown-netbsd" --- -1.8.3.1 - diff --git a/SOURCES/0001-clang-Fix-spurious-test-failure.patch b/SOURCES/0001-clang-Fix-spurious-test-failure.patch deleted file mode 100644 index 39d5088..0000000 --- a/SOURCES/0001-clang-Fix-spurious-test-failure.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 5bfce60443b1c3f4066f506e47cbdc7c4263bb10 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Tue, 11 Aug 2020 18:32:08 -0700 -Subject: [PATCH] clang: Fix spurious test failure - ---- - clang/test/Driver/crash-report-modules.m | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git clang-a/test/Driver/crash-report-modules.m clang-b/test/Driver/crash-report-modules.m -index e6d03353379..9519adf6f4b 100644 ---- clang-a/test/Driver/crash-report-modules.m -+++ clang-b/test/Driver/crash-report-modules.m -@@ -19,7 +19,7 @@ - @import simple; - const int x = MODULE_MACRO; - --// CHECK: PLEASE submit a bug report to {{.*}} and include the crash backtrace, preprocessed source, and associated run script. -+// CHECK: PLEASE submit a bug report to {{.*}}and include the crash backtrace, preprocessed source, and associated run script. - // CHECK: Preprocessed source(s) and associated run script(s) are located at: - // CHECK-NEXT: note: diagnostic msg: {{.*}}.m - // CHECK-NEXT: note: diagnostic msg: {{.*}}.cache --- -2.18.1 - diff --git a/SOURCES/0001-gcc11.patch b/SOURCES/0001-gcc11.patch deleted file mode 100644 index 67629a3..0000000 --- a/SOURCES/0001-gcc11.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/utils/benchmark/src/benchmark_register.h b/utils/benchmark/src/benchmark_register.h -index 0705e219..4caa5ad4 100644 ---- a/llvm/utils/benchmark/src/benchmark_register.h -+++ b/llvm/utils/benchmark/src/benchmark_register.h -@@ -1,6 +1,7 @@ - #ifndef BENCHMARK_REGISTER_H - #define BENCHMARK_REGISTER_H - -+#include - #include - - #include "check.h" diff --git a/SOURCES/0001-scan-view-Remove-Reporter.py-and-associated-AppleScr.patch b/SOURCES/0001-scan-view-Remove-Reporter.py-and-associated-AppleScr.patch deleted file mode 100644 index 5e32c89..0000000 --- a/SOURCES/0001-scan-view-Remove-Reporter.py-and-associated-AppleScr.patch +++ /dev/null @@ -1,299 +0,0 @@ -From f962ce26b4bf716af29b9d4d05860d5fb81cee61 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Fri, 18 Dec 2020 23:16:26 +0000 -Subject: [PATCH] scan-view: Remove Reporter.py and associated AppleScript - files - -I'm not exactly sure what this is, but it appears to be a tool for reporting -internal issues at Apple. These files haven't been meaningfully updated in -12 years, and it doesn't seem like there is any reason to keep them in tree. - -Differential Revision: https://reviews.llvm.org/D93565 ---- - clang/tools/scan-view/CMakeLists.txt | 3 - - clang/tools/scan-view/share/FileRadar.scpt | Bin 18418 -> 0 bytes - .../scan-view/share/GetRadarVersion.scpt | 0 - clang/tools/scan-view/share/Reporter.py | 251 ------------------ - 4 files changed, 254 deletions(-) - delete mode 100644 clang/tools/scan-view/share/FileRadar.scpt - delete mode 100644 clang/tools/scan-view/share/GetRadarVersion.scpt - delete mode 100644 clang/tools/scan-view/share/Reporter.py - -diff --git clang-a/tools/scan-view/CMakeLists.txt clang-b/tools/scan-view/CMakeLists.txt -index 22edb974bac7..dd3d33439299 100644 ---- clang-a/tools/scan-view/CMakeLists.txt -+++ clang-b/tools/scan-view/CMakeLists.txt -@@ -5,10 +5,7 @@ set(BinFiles - - set(ShareFiles - ScanView.py -- Reporter.py - startfile.py -- FileRadar.scpt -- GetRadarVersion.scpt - bugcatcher.ico) - - if(CLANG_INSTALL_SCANVIEW) -diff --git clang-a/tools/scan-view/share/GetRadarVersion.scpt clang-b/tools/scan-view/share/GetRadarVersion.scpt -deleted file mode 100644 -index e69de29bb2d1..000000000000 -diff --git clang-a/tools/scan-view/share/Reporter.py clang-b/tools/scan-view/share/Reporter.py -deleted file mode 100644 -index b1ff16142e27..000000000000 ---- clang-a/tools/scan-view/share/Reporter.py -+++ /dev/null -@@ -1,251 +0,0 @@ --#!/usr/bin/env python --# -*- coding: utf-8 -*- -- --"""Methods for reporting bugs.""" -- --import subprocess, sys, os -- --__all__ = ['ReportFailure', 'BugReport', 'getReporters'] -- --# -- --class ReportFailure(Exception): -- """Generic exception for failures in bug reporting.""" -- def __init__(self, value): -- self.value = value -- --# Collect information about a bug. -- --class BugReport(object): -- def __init__(self, title, description, files): -- self.title = title -- self.description = description -- self.files = files -- --# Reporter interfaces. -- --import os -- --import email, mimetypes, smtplib --from email import encoders --from email.message import Message --from email.mime.base import MIMEBase --from email.mime.multipart import MIMEMultipart --from email.mime.text import MIMEText -- --#===------------------------------------------------------------------------===# --# ReporterParameter --#===------------------------------------------------------------------------===# -- --class ReporterParameter(object): -- def __init__(self, n): -- self.name = n -- def getName(self): -- return self.name -- def getValue(self,r,bugtype,getConfigOption): -- return getConfigOption(r.getName(),self.getName()) -- def saveConfigValue(self): -- return True -- --class TextParameter (ReporterParameter): -- def getHTML(self,r,bugtype,getConfigOption): -- return """\ -- --%s: -- --"""%(self.getName(),r.getName(),self.getName(),self.getValue(r,bugtype,getConfigOption)) -- --class SelectionParameter (ReporterParameter): -- def __init__(self, n, values): -- ReporterParameter.__init__(self,n) -- self.values = values -- -- def getHTML(self,r,bugtype,getConfigOption): -- default = self.getValue(r,bugtype,getConfigOption) -- return """\ -- --%s:"""%(self.getName(),r.getName(),self.getName(),'\n'.join(["""\ --"""%(o[0], -- o[0] == default and ' selected="selected"' or '', -- o[1]) for o in self.values])) -- --#===------------------------------------------------------------------------===# --# Reporters --#===------------------------------------------------------------------------===# -- --class EmailReporter(object): -- def getName(self): -- return 'Email' -- -- def getParameters(self): -- return [TextParameter(x) for x in ['To', 'From', 'SMTP Server', 'SMTP Port']] -- -- # Lifted from python email module examples. -- def attachFile(self, outer, path): -- # Guess the content type based on the file's extension. Encoding -- # will be ignored, although we should check for simple things like -- # gzip'd or compressed files. -- ctype, encoding = mimetypes.guess_type(path) -- if ctype is None or encoding is not None: -- # No guess could be made, or the file is encoded (compressed), so -- # use a generic bag-of-bits type. -- ctype = 'application/octet-stream' -- maintype, subtype = ctype.split('/', 1) -- if maintype == 'text': -- fp = open(path) -- # Note: we should handle calculating the charset -- msg = MIMEText(fp.read(), _subtype=subtype) -- fp.close() -- else: -- fp = open(path, 'rb') -- msg = MIMEBase(maintype, subtype) -- msg.set_payload(fp.read()) -- fp.close() -- # Encode the payload using Base64 -- encoders.encode_base64(msg) -- # Set the filename parameter -- msg.add_header('Content-Disposition', 'attachment', filename=os.path.basename(path)) -- outer.attach(msg) -- -- def fileReport(self, report, parameters): -- mainMsg = """\ --BUG REPORT ----- --Title: %s --Description: %s --"""%(report.title, report.description) -- -- if not parameters.get('To'): -- raise ReportFailure('No "To" address specified.') -- if not parameters.get('From'): -- raise ReportFailure('No "From" address specified.') -- -- msg = MIMEMultipart() -- msg['Subject'] = 'BUG REPORT: %s'%(report.title) -- # FIXME: Get config parameters -- msg['To'] = parameters.get('To') -- msg['From'] = parameters.get('From') -- msg.preamble = mainMsg -- -- msg.attach(MIMEText(mainMsg, _subtype='text/plain')) -- for file in report.files: -- self.attachFile(msg, file) -- -- try: -- s = smtplib.SMTP(host=parameters.get('SMTP Server'), -- port=parameters.get('SMTP Port')) -- s.sendmail(msg['From'], msg['To'], msg.as_string()) -- s.close() -- except: -- raise ReportFailure('Unable to send message via SMTP.') -- -- return "Message sent!" -- --class BugzillaReporter(object): -- def getName(self): -- return 'Bugzilla' -- -- def getParameters(self): -- return [TextParameter(x) for x in ['URL','Product']] -- -- def fileReport(self, report, parameters): -- raise NotImplementedError -- -- --class RadarClassificationParameter(SelectionParameter): -- def __init__(self): -- SelectionParameter.__init__(self,"Classification", -- [['1', 'Security'], ['2', 'Crash/Hang/Data Loss'], -- ['3', 'Performance'], ['4', 'UI/Usability'], -- ['6', 'Serious Bug'], ['7', 'Other']]) -- -- def saveConfigValue(self): -- return False -- -- def getValue(self,r,bugtype,getConfigOption): -- if bugtype.find("leak") != -1: -- return '3' -- elif bugtype.find("dereference") != -1: -- return '2' -- elif bugtype.find("missing ivar release") != -1: -- return '3' -- else: -- return '7' -- --class RadarReporter(object): -- @staticmethod -- def isAvailable(): -- # FIXME: Find this .scpt better -- path = os.path.join(os.path.dirname(__file__),'../share/scan-view/GetRadarVersion.scpt') -- try: -- p = subprocess.Popen(['osascript',path], -- stdout=subprocess.PIPE, stderr=subprocess.PIPE) -- except: -- return False -- data,err = p.communicate() -- res = p.wait() -- # FIXME: Check version? Check for no errors? -- return res == 0 -- -- def getName(self): -- return 'Radar' -- -- def getParameters(self): -- return [ TextParameter('Component'), TextParameter('Component Version'), -- RadarClassificationParameter() ] -- -- def fileReport(self, report, parameters): -- component = parameters.get('Component', '') -- componentVersion = parameters.get('Component Version', '') -- classification = parameters.get('Classification', '') -- personID = "" -- diagnosis = "" -- config = "" -- -- if not component.strip(): -- component = 'Bugs found by clang Analyzer' -- if not componentVersion.strip(): -- componentVersion = 'X' -- -- script = os.path.join(os.path.dirname(__file__),'../share/scan-view/FileRadar.scpt') -- args = ['osascript', script, component, componentVersion, classification, personID, report.title, -- report.description, diagnosis, config] + [os.path.abspath(f) for f in report.files] --# print >>sys.stderr, args -- try: -- p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) -- except: -- raise ReportFailure("Unable to file radar (AppleScript failure).") -- data, err = p.communicate() -- res = p.wait() -- -- if res: -- raise ReportFailure("Unable to file radar (AppleScript failure).") -- -- try: -- values = eval(data) -- except: -- raise ReportFailure("Unable to process radar results.") -- -- # We expect (int: bugID, str: message) -- if len(values) != 2 or not isinstance(values[0], int): -- raise ReportFailure("Unable to process radar results.") -- -- bugID,message = values -- bugID = int(bugID) -- -- if not bugID: -- raise ReportFailure(message) -- -- return "Filed: %d"%(bugID,bugID) -- --### -- --def getReporters(): -- reporters = [] -- if RadarReporter.isAvailable(): -- reporters.append(RadarReporter()) -- reporters.append(EmailReporter()) -- return reporters -- --- -2.26.2 - diff --git a/SOURCES/0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch b/SOURCES/0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch new file mode 100644 index 0000000..14f6d48 --- /dev/null +++ b/SOURCES/0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch @@ -0,0 +1,40 @@ +From 07b062e1f7c3359550aa8c0a7b86f6054971439d Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Thu, 25 Feb 2021 14:09:29 +0100 +Subject: [PATCH 2/6] [PATCH][clang] Make -funwind-tables the default on all + archs + +--- + lib/Driver/ToolChain.cpp | 2 +- + lib/Driver/ToolChains/Gnu.cpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp +index b2ddef1..715b323 100644 +--- a/lib/Driver/ToolChain.cpp ++++ b/lib/Driver/ToolChain.cpp +@@ -257,7 +257,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const { + } + + bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const { +- return false; ++ return true; + } + + Tool *ToolChain::getClang() const { +diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp +index 1d8a3cd..5deeb10 100644 +--- a/lib/Driver/ToolChains/Gnu.cpp ++++ b/lib/Driver/ToolChains/Gnu.cpp +@@ -2713,7 +2713,7 @@ bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const { + case llvm::Triple::x86_64: + return true; + default: +- return false; ++ return true; + } + } + +-- +1.8.3.1 + diff --git a/SOURCES/0002-gtest-reorg.patch b/SOURCES/0002-gtest-reorg.patch deleted file mode 100644 index 121ac46..0000000 --- a/SOURCES/0002-gtest-reorg.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 1f26a0284925859b72ee520ce74452d77d822409 Mon Sep 17 00:00:00 2001 -From: serge-sans-paille -Date: Mon, 28 Jan 2019 19:12:27 +0000 -Subject: [PATCH 2/2] [PATCH] gtest reorg - ---- - CMakeLists.txt | 12 +++++------- - 1 file changed, 5 insertions(+), 7 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c2016a45ca..48ea3c3bb9 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -157,12 +157,6 @@ Please install Python or specify the PYTHON_EXECUTABLE CMake variable.") - set(LLVM_UTILS_PROVIDED ON) - set(CLANG_TEST_DEPS FileCheck count not) - endif() -- set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest) -- if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h -- AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} -- AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt) -- add_subdirectory(${UNITTEST_DIR} utils/unittest) -- endif() - else() - # Seek installed Lit. - find_program(LLVM_LIT -@@ -507,7 +501,11 @@ endif() - - - if( CLANG_INCLUDE_TESTS ) -- if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h) -+ set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest) -+ if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h -+ AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} -+ AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt) -+ add_subdirectory(${UNITTEST_DIR} utils/unittest) - add_subdirectory(unittests) - list(APPEND CLANG_TEST_DEPS ClangUnitTests) - list(APPEND CLANG_TEST_PARAMS --- -2.19.2 - diff --git a/SOURCES/0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch b/SOURCES/0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch new file mode 100644 index 0000000..7547279 --- /dev/null +++ b/SOURCES/0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch @@ -0,0 +1,77 @@ +From 1ef1e91142ac48ecb826f33e1e7072c7402d9fe7 Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Wed, 3 Mar 2021 09:58:31 +0100 +Subject: [PATCH 6/6] [PATCH][clang] Allow __ieee128 as an alias to __float128 + on ppc + +This matches gcc behavior. + +Differential Revision: https://reviews.llvm.org/D97846 + +(cherry picked from commit 4aa510be78a75a4da82657fe433016f00dad0784) +--- + include/Basic/LangOptions.def | 1 + + lib/Basic/IdentifierTable.cpp | 3 +++ + lib/Basic/Targets/PPC.cpp | 1 + + test/Sema/128bitfloat.cpp | 7 +++++++ + 4 files changed, 12 insertions(+) + +diff --git a/include/clang/Basic/LangOptions.def b/include/clang/Basic/LangOptions.def +index c01f0cc..3c22393e 100644 +--- a/include/clang/Basic/LangOptions.def ++++ b/include/clang/Basic/LangOptions.def +@@ -107,6 +107,7 @@ LANGOPT(Bool , 1, 0, "bool, true, and false keywords") + LANGOPT(Half , 1, 0, "half keyword") + LANGOPT(WChar , 1, CPlusPlus, "wchar_t keyword") + LANGOPT(Char8 , 1, 0, "char8_t keyword") ++LANGOPT(IEEE128 , 1, 0, "__ieee128 keyword") + LANGOPT(DeclSpecKeyword , 1, 0, "__declspec keyword") + BENIGN_LANGOPT(DollarIdents , 1, 1, "'$' in identifiers") + BENIGN_LANGOPT(AsmPreprocessor, 1, 0, "preprocessor in asm mode") +diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp +index 51c6e02..cedc94a 100644 +--- a/lib/Basic/IdentifierTable.cpp ++++ b/lib/Basic/IdentifierTable.cpp +@@ -227,6 +227,9 @@ void IdentifierTable::AddKeywords(const LangOptions &LangOpts) { + if (LangOpts.DeclSpecKeyword) + AddKeyword("__declspec", tok::kw___declspec, KEYALL, LangOpts, *this); + ++ if (LangOpts.IEEE128) ++ AddKeyword("__ieee128", tok::kw___float128, KEYALL, LangOpts, *this); ++ + // Add the 'import' contextual keyword. + get("import").setModulesImport(true); + } +diff --git a/lib/Basic/Targets/PPC.cpp b/lib/Basic/Targets/PPC.cpp +index ff09c0f..38f286c 100644 +--- a/lib/Basic/Targets/PPC.cpp ++++ b/lib/Basic/Targets/PPC.cpp +@@ -551,6 +551,7 @@ void PPCTargetInfo::adjust(LangOptions &Opts) { + LongDoubleFormat = Opts.PPCIEEELongDouble + ? &llvm::APFloat::IEEEquad() + : &llvm::APFloat::PPCDoubleDouble(); ++ Opts.IEEE128 = 1; + } + + ArrayRef PPCTargetInfo::getTargetBuiltins() const { +diff --git a/test/Sema/128bitfloat.cpp b/test/Sema/128bitfloat.cpp +index 4a826b4..6a9ae74 100644 +--- a/test/Sema/128bitfloat.cpp ++++ b/test/Sema/128bitfloat.cpp +@@ -6,6 +6,13 @@ + // RUN: %clang_cc1 -triple x86_64-windows-msvc -verify -std=c++11 %s + + #if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__) ++ ++#if defined(__ppc__) ++template struct __is_float128 { static constexpr bool value = false; }; ++template <> struct __is_float128<__float128> { static constexpr bool value = true; }; ++static_assert(__is_float128<__ieee128>::value, "__ieee128 aliases to __float128"); ++#endif ++ + __float128 f; + template struct __is_floating_point_helper {}; + template<> struct __is_floating_point_helper<__float128> {}; +-- +1.8.3.1 + diff --git a/SPECS/llvm-compat.spec b/SPECS/llvm-compat.spec index dd89721..7ec8d13 100644 --- a/SPECS/llvm-compat.spec +++ b/SPECS/llvm-compat.spec @@ -1,7 +1,7 @@ -%global maj_ver 11 +%global maj_ver 12 %global min_ver 0 %global patch_ver 1 -%global baserelease 1 +%global baserelease 3 # Limit build jobs on ppc64 systems to avoid running out of memory. %global _smp_mflags -j8 @@ -17,22 +17,15 @@ Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{versio Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/clang-%{version}.src.tar.xz # LLVM Patches: -Patch1: 0001-SystemZ-Use-LA-instead-of-AGR-in-eliminateFrameIndex.patch -Patch2: 0001-gcc11.patch -Patch3: 0001-SystemZ-Assign-the-full-space-for-promoted-and-split.patch -Patch4: 0001-MemCpyOpt-Correctly-merge-alias-scopes-during-call-s.patch # Clang Patches: -Patch104: 0002-gtest-reorg.patch -Patch111: 0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch -Patch113: 0001-Make-funwind-tables-the-default-for-all-archs.patch +Patch101: 0001-PATCH-clang-Reorganize-gtest-integration.patch +Patch102: 0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch +Patch103: 0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch # Not Upstream Patch115: 0001-clang-Don-t-install-static-libraries.patch -Patch116: 0001-clang-Fix-spurious-test-failure.patch Patch117: 0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch -Patch118: 0001-scan-view-Remove-Reporter.py-and-associated-AppleScr.patch -Patch119: 0001-Partially-Revert-scan-view-Remove-Reporter.py-and-as.patch BuildRequires: gcc @@ -101,7 +94,7 @@ pushd llvm-build -DLLVM_LIBDIR_SUFFIX= \ %endif \ - -DLLVM_TARGETS_TO_BUILD="X86;AMDGPU;PowerPC;NVPTX;SystemZ;AArch64;ARM;Mips;BPF" \ + -DLLVM_TARGETS_TO_BUILD="X86;AMDGPU;PowerPC;NVPTX;SystemZ;AArch64;ARM;Mips;BPF;WebAssembly" \ -DLLVM_ENABLE_LIBCXX:BOOL=OFF \ -DLLVM_ENABLE_ZLIB:BOOL=ON \ -DLLVM_ENABLE_FFI:BOOL=ON \ @@ -164,6 +157,12 @@ install clang-build/%{_lib}/*.so.%{maj_ver} %{buildroot}%{_libdir} %{_libdir}/libclang*.so.%{maj_ver} %changelog +* Mon Nov 01 2021 Tom Stellard - 12.0.1-3 +- Enable WebAssembly target + +* Fri Oct 15 2021 Tom Stellard - 12.0.1-2 +- 12.0.1 Release + * Tue Jun 1 2021 sguelton@redhat.com - 11.0.1-1 - 11.0.1 Release