From 3ac0c7a1f6a051d22ad5f3e155cae3678274533a Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jun 23 2021 19:31:07 +0000 Subject: import llvm-compat-11.0.1-1.module+el8.5.0+11349+a984027f --- diff --git a/.gitignore b/.gitignore index 7fa9892..2e05970 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -SOURCES/clang-10.0.1.src.tar.xz -SOURCES/llvm-10.0.1.src.tar.xz +SOURCES/clang-11.0.1.src.tar.xz +SOURCES/llvm-11.0.1.src.tar.xz diff --git a/.llvm-compat.metadata b/.llvm-compat.metadata index 27fb020..07f3fa1 100644 --- a/.llvm-compat.metadata +++ b/.llvm-compat.metadata @@ -1,2 +1,2 @@ -0e61e92b22a620fe7f833fa8b2a56f2db96f7335 SOURCES/clang-10.0.1.src.tar.xz -25d07260f3b7bf4f647e115c4a663fdeda130fbd SOURCES/llvm-10.0.1.src.tar.xz +10516c6d177dc3d893e640c75d891ee3d6c1edcf SOURCES/clang-11.0.1.src.tar.xz +1a911295260d4e41116b72788eb602702b4bb252 SOURCES/llvm-11.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 new file mode 100644 index 0000000..0050b40 --- /dev/null +++ b/SOURCES/0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch @@ -0,0 +1,132 @@ +From 67013ee5feecca0c1e1dd8a149b20779a9b6c12a 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 + +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 +maintains a list of supported triples for each target and when all +else is equal will prefer toolchains with triples that appear earlier +in the list. + +The cross-compiler triple on Fedora is x86_64-linux-gnu and this comes +before the Fedora system compiler's triple: x86_64-redhat-linux in +the triples list, so the cross compiler is always preferred. This +is a problem, because the cross compiler is missing libraries, like +libgcc_s.so, that clang expects to be there so linker invocations +will fail. + +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 ++++++++++++ + 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 +--- a/lib/Driver/ToolChains/Gnu.cpp ++++ b/lib/Driver/ToolChains/Gnu.cpp +@@ -2500,6 +2500,8 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( + (TargetArch == llvm::Triple::x86 && + TargetTriple.getOS() != llvm::Triple::Solaris)}}; + ++ bool NeedLibgccShared = !Args.hasArg(options::OPT_static_libgcc) && ++ !Args.hasArg(options::OPT_static); + for (auto &Suffix : Suffixes) { + if (!Suffix.Active) + continue; +@@ -2517,8 +2519,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; +- if (CandidateVersion <= Version) +- continue; ++ ++ bool CandidateHasLibGccShared = false; ++ if (CandidateVersion <= Version) { ++ if (NeedLibgccShared && !HasLibGccShared) { ++ CandidateHasLibGccShared = ++ D.getVFS().exists(LI->path() + "/libgcc_s.so"); ++ ++ } ++ if (HasLibGccShared || !CandidateHasLibGccShared) ++ continue; ++ } + + if (!ScanGCCForMultilibs(TargetTriple, Args, LI->path(), + NeedsBiarchSuffix)) +@@ -2532,6 +2543,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( + GCCInstallPath = (LibDir + "/" + LibSuffix + "/" + VersionText).str(); + GCCParentLibPath = (GCCInstallPath + "/../" + Suffix.ReversePath).str(); + IsValid = true; ++ HasLibGccShared = CandidateHasLibGccShared; + } + } + } +diff --git a/lib/Driver/ToolChains/Gnu.h b/lib/Driver/ToolChains/Gnu.h +index 52690ab4..2a4452d9 100644 +--- a/lib/Driver/ToolChains/Gnu.h ++++ b/lib/Driver/ToolChains/Gnu.h +@@ -190,6 +190,7 @@ public: + /// Driver, and has logic for fuzzing that where appropriate. + class GCCInstallationDetector { + bool IsValid; ++ bool HasLibGccShared; + llvm::Triple GCCTriple; + const Driver &D; + +@@ -213,7 +214,8 @@ public: + MultilibSet Multilibs; + + public: +- explicit GCCInstallationDetector(const Driver &D) : IsValid(false), D(D) {} ++ explicit GCCInstallationDetector(const Driver &D) ++ : IsValid(false), HasLibGccShared(false), D(D) {} + void init(const llvm::Triple &TargetTriple, const llvm::opt::ArgList &Args, + ArrayRef ExtraTripleAliases = None); + +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 +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 +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 +diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c +index ec539522..95725d5c 100644 +--- a/test/Driver/linux-ld.c ++++ b/test/Driver/linux-ld.c +@@ -784,6 +784,18 @@ + // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crtend.o" + // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crtn.o" + // ++// Check that clang does not select the cross compiler by default on Fedora 28. ++// ++// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ ++// RUN: --target=x86_64-unknown-linux-gnu \ ++// RUN: --gcc-toolchain="" \ ++// RUN: --sysroot=%S/Inputs/fedora_28_tree \ ++// RUN: | FileCheck --check-prefix=CHECK-FEDORA-28-X86_64 %s ++// ++// CHECK-FEDORA-28-X86_64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" ++// CHECK-FEDORA-28-X86_64: "[[SYSROOT]]/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o" ++// CHECK-FEDORA-28-X86_64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-redhat-linux/7" ++// + // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ + // RUN: --target=arm-unknown-linux-gnueabi -rtlib=platform \ + // RUN: --gcc-toolchain="" \ +-- +2.25.2 + 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 index d9e9125..b3d115c 100644 --- a/SOURCES/0001-Make-funwind-tables-the-default-for-all-archs.patch +++ b/SOURCES/0001-Make-funwind-tables-the-default-for-all-archs.patch @@ -8,10 +8,10 @@ Subject: [PATCH] Make -funwind-tables the default for all archs clang/lib/Driver/ToolChains/Gnu.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp +diff --git clang-a/lib/Driver/ToolChain.cpp clang-b/lib/Driver/ToolChain.cpp index b1fddb0af55..43af40ed0e8 100644 ---- a/clang/lib/Driver/ToolChain.cpp -+++ b/clang/lib/Driver/ToolChain.cpp +--- clang-a/lib/Driver/ToolChain.cpp ++++ clang-b/lib/Driver/ToolChain.cpp @@ -244,7 +244,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const { } @@ -21,10 +21,10 @@ index b1fddb0af55..43af40ed0e8 100644 } Tool *ToolChain::getClang() const { -diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +diff --git clang-a/lib/Driver/ToolChains/Gnu.cpp clang-b/lib/Driver/ToolChains/Gnu.cpp index 33cdd3585c2..15e82be8f3a 100644 ---- a/clang/lib/Driver/ToolChains/Gnu.cpp -+++ b/clang/lib/Driver/ToolChains/Gnu.cpp +--- 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 { } 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 new file mode 100644 index 0000000..411d94f --- /dev/null +++ b/SOURCES/0001-MemCpyOpt-Correctly-merge-alias-scopes-during-call-s.patch @@ -0,0 +1,373 @@ +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-Partially-Revert-scan-view-Remove-Reporter.py-and-as.patch b/SOURCES/0001-Partially-Revert-scan-view-Remove-Reporter.py-and-as.patch new file mode 100644 index 0000000..6c1d6e0 --- /dev/null +++ b/SOURCES/0001-Partially-Revert-scan-view-Remove-Reporter.py-and-as.patch @@ -0,0 +1,224 @@ +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-PowerPC-PPCBoolRetToInt-Don-t-translate-Constant-s-o.patch b/SOURCES/0001-PowerPC-PPCBoolRetToInt-Don-t-translate-Constant-s-o.patch deleted file mode 100644 index 07b96b8..0000000 --- a/SOURCES/0001-PowerPC-PPCBoolRetToInt-Don-t-translate-Constant-s-o.patch +++ /dev/null @@ -1,99 +0,0 @@ -From cbea17568f4301582c1d5d43990f089ca6cff522 Mon Sep 17 00:00:00 2001 -From: Kai Luo -Date: Fri, 28 Aug 2020 01:56:12 +0000 -Subject: [PATCH] [PowerPC] PPCBoolRetToInt: Don't translate Constant's - operands - -When collecting `i1` values via `findAllDefs`, ignore Constant's -operands, since Constant's operands might not be `i1`. - -Fixes https://bugs.llvm.org/show_bug.cgi?id=46923 which causes ICE -``` -llvm-project/llvm/lib/IR/Constants.cpp:1924: static llvm::Constant *llvm::ConstantExpr::getZExt(llvm::Constant *, llvm::Type *, bool): Assertion `C->getType()->getScalarSizeInBits() < Ty->getScalarSizeInBits()&& "SrcTy must be smaller than DestTy for ZExt!"' failed. -``` - -Differential Revision: https://reviews.llvm.org/D85007 ---- - llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp | 15 ++++++----- - llvm/test/CodeGen/PowerPC/pr46923.ll | 29 +++++++++++++++++++++ - 2 files changed, 38 insertions(+), 6 deletions(-) - create mode 100644 llvm/test/CodeGen/PowerPC/pr46923.ll - -diff --git a/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp b/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp -index acc8b317a22..172f1346c50 100644 ---- a/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp -+++ b/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp -@@ -78,9 +78,9 @@ class PPCBoolRetToInt : public FunctionPass { - Value *Curr = WorkList.back(); - WorkList.pop_back(); - auto *CurrUser = dyn_cast(Curr); -- // Operands of CallInst are skipped because they may not be Bool type, -- // and their positions are defined by ABI. -- if (CurrUser && !isa(Curr)) -+ // Operands of CallInst/Constant are skipped because they may not be Bool -+ // type. For CallInst, their positions are defined by ABI. -+ if (CurrUser && !isa(Curr) && !isa(Curr)) - for (auto &Op : CurrUser->operands()) - if (Defs.insert(Op).second) - WorkList.push_back(Op); -@@ -90,6 +90,9 @@ class PPCBoolRetToInt : public FunctionPass { - - // Translate a i1 value to an equivalent i32/i64 value: - Value *translate(Value *V) { -+ assert(V->getType() == Type::getInt1Ty(V->getContext()) && -+ "Expect an i1 value"); -+ - Type *IntTy = ST->isPPC64() ? Type::getInt64Ty(V->getContext()) - : Type::getInt32Ty(V->getContext()); - -@@ -252,9 +255,9 @@ class PPCBoolRetToInt : public FunctionPass { - auto *First = dyn_cast(Pair.first); - auto *Second = dyn_cast(Pair.second); - assert((!First || Second) && "translated from user to non-user!?"); -- // Operands of CallInst are skipped because they may not be Bool type, -- // and their positions are defined by ABI. -- if (First && !isa(First)) -+ // Operands of CallInst/Constant are skipped because they may not be Bool -+ // type. For CallInst, their positions are defined by ABI. -+ if (First && !isa(First) && !isa(First)) - for (unsigned i = 0; i < First->getNumOperands(); ++i) - Second->setOperand(i, BoolToIntMap[First->getOperand(i)]); - } -diff --git a/llvm/test/CodeGen/PowerPC/pr46923.ll b/llvm/test/CodeGen/PowerPC/pr46923.ll -new file mode 100644 -index 00000000000..3e9faa60422 ---- /dev/null -+++ b/llvm/test/CodeGen/PowerPC/pr46923.ll -@@ -0,0 +1,29 @@ -+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-unknown \ -+; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s -+ -+@bar = external constant i64, align 8 -+ -+define i1 @foo() { -+; CHECK-LABEL: foo: -+; CHECK: # %bb.0: # %entry -+; CHECK-NEXT: li r3, 0 -+; CHECK-NEXT: isel r3, 0, r3, 4*cr5+lt -+; CHECK-NEXT: blr -+entry: -+ br label %next -+ -+next: -+ br i1 undef, label %true, label %false -+ -+true: -+ br label %end -+ -+false: -+ br label %end -+ -+end: -+ %a = phi i1 [ icmp ugt (i64 0, i64 ptrtoint (i64* @bar to i64)), %true ], -+ [ icmp ugt (i64 0, i64 2), %false ] -+ ret i1 %a -+} --- -2.25.2 - 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 new file mode 100644 index 0000000..db1b5e2 --- /dev/null +++ b/SOURCES/0001-SystemZ-Assign-the-full-space-for-promoted-and-split.patch @@ -0,0 +1,157 @@ +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 new file mode 100644 index 0000000..80d6a1e --- /dev/null +++ b/SOURCES/0001-SystemZ-Use-LA-instead-of-AGR-in-eliminateFrameIndex.patch @@ -0,0 +1,166 @@ +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-clang-Don-t-install-static-libraries.patch b/SOURCES/0001-clang-Don-t-install-static-libraries.patch new file mode 100644 index 0000000..da5b4e7 --- /dev/null +++ b/SOURCES/0001-clang-Don-t-install-static-libraries.patch @@ -0,0 +1,25 @@ +From 8097a9d4295dbc39cbd541ccace7bc5884852366 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Fri, 31 Jan 2020 11:04:57 -0800 +Subject: [PATCH] clang: Don't install static libraries + +--- + clang/cmake/modules/AddClang.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git clang-a/cmake/modules/AddClang.cmake clang-b/cmake/modules/AddClang.cmake +index 704278a0e93..1737b24a2bc 100644 +--- clang-a/cmake/modules/AddClang.cmake ++++ clang-b/cmake/modules/AddClang.cmake +@@ -111,7 +111,7 @@ macro(add_clang_library name) + if(TARGET ${lib}) + target_link_libraries(${lib} INTERFACE ${LLVM_COMMON_LIBS}) + +- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN) ++ if (ARG_SHARED AND (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)) + set(export_to_clangtargets) + if(${lib} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR + "clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR +-- +2.18.1 + diff --git a/SOURCES/0001-clang-Fix-spurious-test-failure.patch b/SOURCES/0001-clang-Fix-spurious-test-failure.patch new file mode 100644 index 0000000..39d5088 --- /dev/null +++ b/SOURCES/0001-clang-Fix-spurious-test-failure.patch @@ -0,0 +1,25 @@ +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 new file mode 100644 index 0000000..67629a3 --- /dev/null +++ b/SOURCES/0001-gcc11.patch @@ -0,0 +1,12 @@ +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 new file mode 100644 index 0000000..5e32c89 --- /dev/null +++ b/SOURCES/0001-scan-view-Remove-Reporter.py-and-associated-AppleScr.patch @@ -0,0 +1,299 @@ +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/bab5908df544680ada0a3cf431f55aeccfbdb321.patch b/SOURCES/bab5908df544680ada0a3cf431f55aeccfbdb321.patch deleted file mode 100644 index 2a93e6a..0000000 --- a/SOURCES/bab5908df544680ada0a3cf431f55aeccfbdb321.patch +++ /dev/null @@ -1,23 +0,0 @@ -From bab5908df544680ada0a3cf431f55aeccfbdb321 Mon Sep 17 00:00:00 2001 -From: serge-sans-paille -Date: Mon, 13 Apr 2020 13:44:15 +0200 -Subject: [PATCH] Normalize working directory when running llvm-mc in test - -Otherwise, depending on the lit location used to run the test, llvm-mc adds an -include_directories entry in the dwarf output, which breaks tests in some setup. - -Differential Revision: https://reviews.llvm.org/D77876 ---- - llvm/test/MC/MachO/gen-dwarf.s | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/llvm/test/MC/MachO/gen-dwarf.s b/llvm/test/MC/MachO/gen-dwarf.s -index 0813856d625f..6d39d278e818 100644 ---- a/llvm/test/MC/MachO/gen-dwarf.s -+++ b/llvm/test/MC/MachO/gen-dwarf.s -@@ -1,4 +1,4 @@ --// RUN: llvm-mc -g -triple i386-apple-darwin10 %s -filetype=obj -o %t -+// RUN: mkdir -p %t0 && cd %t0 && llvm-mc -g -triple i386-apple-darwin10 %s -filetype=obj -o %t - // RUN: llvm-dwarfdump -all %t | FileCheck %s - - .globl _bar diff --git a/SPECS/llvm-compat.spec b/SPECS/llvm-compat.spec index 3858b6b..dd89721 100644 --- a/SPECS/llvm-compat.spec +++ b/SPECS/llvm-compat.spec @@ -1,4 +1,4 @@ -%global maj_ver 10 +%global maj_ver 11 %global min_ver 0 %global patch_ver 1 %global baserelease 1 @@ -17,13 +17,22 @@ 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: -Patch4: bab5908df544680ada0a3cf431f55aeccfbdb321.patch -Patch5: 0001-PowerPC-PPCBoolRetToInt-Don-t-translate-Constant-s-o.patch +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: -Patch100: 0002-gtest-reorg.patch -Patch102: 0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch -Patch103: 0001-Make-funwind-tables-the-default-for-all-archs.patch +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 + +# 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 @@ -60,15 +69,10 @@ Shared libraries for the LLVM compiler infrastructure. %prep %setup -T -q -b 1 -n clang-%{version}.src - -%patch100 -p1 -%patch102 -p1 -%patch103 -p2 +%autopatch -m100 -p1 %setup -q -n llvm-%{version}.src - -%patch4 -p2 -%patch5 -p2 +%autopatch -M100 -p2 %build @@ -124,9 +128,10 @@ pushd clang-build -DCLANG_PLUGIN_SUPPORT:BOOL=ON \ -DENABLE_LINKER_BUILD_ID:BOOL=ON \ -DLLVM_ENABLE_EH=ON \ + -DBUILD_SHARED_LIBS=OFF \ -DLLVM_ENABLE_RTTI=ON \ - -DLLVM_INCLUDE_TESTS=OFF \ - -DCMAKE_SKIP_RPATH:BOOL=ON \ + -DLLVM_INCLUDE_TESTS=OFF \ + -DCMAKE_SKIP_RPATH:BOOL=ON \ %if 0%{?__isa_bits} == 64 -DLLVM_LIBDIR_SUFFIX=64 \ %else @@ -159,6 +164,9 @@ install clang-build/%{_lib}/*.so.%{maj_ver} %{buildroot}%{_libdir} %{_libdir}/libclang*.so.%{maj_ver} %changelog +* Tue Jun 1 2021 sguelton@redhat.com - 11.0.1-1 +- 11.0.1 Release + * Fri Sep 25 2020 sguelton@redhat.com - 10.0.1-1 - 10.0.1 Release