mirror of
https://github.com/dslm4515/BMLFS.git
synced 2025-08-15 22:40:32 +00:00
Upgraded llvm to 10.0.1
This commit is contained in:
44
patches/llvm-void/clang-001-fix-unwind-chain-inclusion.patch
Normal file
44
patches/llvm-void/clang-001-fix-unwind-chain-inclusion.patch
Normal file
@ -0,0 +1,44 @@
|
||||
From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Brancaleoni <miwaxe@gmail.com>
|
||||
Date: Tue, 8 Sep 2015 22:14:57 +0200
|
||||
Subject: [PATCH 2/7] fix unwind chain inclusion
|
||||
|
||||
---
|
||||
lib/Headers/unwind.h | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
|
||||
index 303d792..44e10cc 100644
|
||||
--- a/lib/Headers/unwind.h
|
||||
+++ b/lib/Headers/unwind.h
|
||||
@@ -9,9 +9,6 @@
|
||||
|
||||
/* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
|
||||
|
||||
-#ifndef __CLANG_UNWIND_H
|
||||
-#define __CLANG_UNWIND_H
|
||||
-
|
||||
#if defined(__APPLE__) && __has_include_next(<unwind.h>)
|
||||
/* Darwin (from 11.x on) provide an unwind.h. If that's available,
|
||||
* use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
|
||||
@@ -39,6 +36,9 @@
|
||||
# endif
|
||||
#else
|
||||
|
||||
+#ifndef __CLANG_UNWIND_H
|
||||
+#define __CLANG_UNWIND_H
|
||||
+
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
|
||||
}
|
||||
#endif
|
||||
|
||||
+#endif /* __CLANG_UNWIND_H */
|
||||
+
|
||||
#endif
|
||||
|
||||
-#endif /* __CLANG_UNWIND_H */
|
||||
--
|
||||
2.5.1
|
91
patches/llvm-void/clang-002-add-musl-triples.patch
Normal file
91
patches/llvm-void/clang-002-add-musl-triples.patch
Normal file
@ -0,0 +1,91 @@
|
||||
--- a/lib/Driver/ToolChains/Gnu.cpp
|
||||
+++ b/lib/Driver/ToolChains/Gnu.cpp
|
||||
@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
|
||||
static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
|
||||
"armv7hl-redhat-linux-gnueabi",
|
||||
"armv6hl-suse-linux-gnueabi",
|
||||
- "armv7hl-suse-linux-gnueabi"};
|
||||
+ "armv7hl-suse-linux-gnueabi",
|
||||
+ "armv7l-linux-gnueabihf"};
|
||||
static const char *const ARMebLibDirs[] = {"/lib"};
|
||||
static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
|
||||
"armeb-linux-androideabi"};
|
||||
@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (TargetTriple.isMusl()) {
|
||||
+ static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
|
||||
+ static const char *const ARMHFMuslTriples[] = {
|
||||
+ "arm-linux-musleabihf", "armv7l-linux-musleabihf"
|
||||
+ };
|
||||
+ static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
|
||||
+ static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
|
||||
+ static const char *const X86MuslTriples[] = {"i686-linux-musl"};
|
||||
+ static const char *const MIPSMuslTriples[] = {
|
||||
+ "mips-linux-musl", "mipsel-linux-musl",
|
||||
+ "mipsel-linux-muslhf", "mips-linux-muslhf"
|
||||
+ };
|
||||
+ static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
|
||||
+ static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
|
||||
+ static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
|
||||
+
|
||||
+ switch (TargetTriple.getArch()) {
|
||||
+ case llvm::Triple::aarch64:
|
||||
+ LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
|
||||
+ TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
|
||||
+ BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
|
||||
+ BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
|
||||
+ break;
|
||||
+ case llvm::Triple::arm:
|
||||
+ LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
|
||||
+ if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
|
||||
+ TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
|
||||
+ } else {
|
||||
+ TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
|
||||
+ }
|
||||
+ break;
|
||||
+ case llvm::Triple::x86_64:
|
||||
+ LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
|
||||
+ TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
|
||||
+ BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
|
||||
+ BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
|
||||
+ break;
|
||||
+ case llvm::Triple::x86:
|
||||
+ LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
|
||||
+ TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
|
||||
+ BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
|
||||
+ BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
|
||||
+ break;
|
||||
+ case llvm::Triple::mips:
|
||||
+ LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
|
||||
+ TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
|
||||
+ break;
|
||||
+ case llvm::Triple::ppc:
|
||||
+ LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
|
||||
+ TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
|
||||
+ BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
|
||||
+ BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
|
||||
+ break;
|
||||
+ case llvm::Triple::ppc64:
|
||||
+ LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
|
||||
+ TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
|
||||
+ BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
|
||||
+ BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
|
||||
+ break;
|
||||
+ case llvm::Triple::ppc64le:
|
||||
+ LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
|
||||
+ TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ TripleAliases.push_back(TargetTriple.str());
|
||||
+ if (TargetTriple.str() != BiarchTriple.str())
|
||||
+ BiarchTripleAliases.push_back(BiarchTriple.str());
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
// Android targets should not use GNU/Linux tools or libraries.
|
||||
if (TargetTriple.isAndroid()) {
|
||||
static const char *const AArch64AndroidTriples[] = {
|
18
patches/llvm-void/clang-003-ppc64-dynamic-linker-path.patch
Normal file
18
patches/llvm-void/clang-003-ppc64-dynamic-linker-path.patch
Normal file
@ -0,0 +1,18 @@
|
||||
--- a/lib/Driver/ToolChains/Linux.cpp
|
||||
+++ b/lib/Driver/ToolChains/Linux.cpp
|
||||
@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
|
||||
Loader = "ld.so.1";
|
||||
break;
|
||||
case llvm::Triple::ppc64:
|
||||
- LibDir = "lib64";
|
||||
+ LibDir = "lib";
|
||||
Loader =
|
||||
- (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
|
||||
+ (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
|
||||
break;
|
||||
case llvm::Triple::ppc64le:
|
||||
- LibDir = "lib64";
|
||||
+ LibDir = "lib";
|
||||
Loader =
|
||||
(tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
|
||||
break;
|
30
patches/llvm-void/clang-004-ppc64-musl-elfv2.patch
Normal file
30
patches/llvm-void/clang-004-ppc64-musl-elfv2.patch
Normal file
@ -0,0 +1,30 @@
|
||||
--- a/lib/Basic/Targets/PPC.h
|
||||
+++ b/lib/Basic/Targets/PPC.h
|
||||
@@ -386,11 +386,10 @@ public:
|
||||
|
||||
if ((Triple.getArch() == llvm::Triple::ppc64le)) {
|
||||
resetDataLayout("e-m:e-i64:64-n32:64");
|
||||
- ABI = "elfv2";
|
||||
} else {
|
||||
resetDataLayout("E-m:e-i64:64-n32:64");
|
||||
- ABI = "elfv1";
|
||||
}
|
||||
+ ABI = "elfv2";
|
||||
|
||||
if (Triple.getOS() == llvm::Triple::AIX)
|
||||
SuitableAlign = 64;
|
||||
--- a/lib/Driver/ToolChains/Clang.cpp
|
||||
+++ b/lib/Driver/ToolChains/Clang.cpp
|
||||
@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
|
||||
ABIName = "elfv1-qpx";
|
||||
break;
|
||||
}
|
||||
-
|
||||
- if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
|
||||
- ABIName = "elfv2";
|
||||
- else
|
||||
- ABIName = "elfv1";
|
||||
+ ABIName = "elfv2";
|
||||
break;
|
||||
}
|
||||
case llvm::Triple::ppc64le:
|
11
patches/llvm-void/compiler-rt-armv5.patch
Normal file
11
patches/llvm-void/compiler-rt-armv5.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
|
||||
+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
|
||||
@@ -428,8 +428,6 @@
|
||||
)
|
||||
set(arm_Thumb1_SOURCES
|
||||
${arm_Thumb1_JT_SOURCES}
|
||||
- ${arm_Thumb1_SjLj_EH_SOURCES}
|
||||
- ${arm_Thumb1_VFPv2_SOURCES}
|
||||
${arm_Thumb1_icache_SOURCES}
|
||||
)
|
||||
|
58
patches/llvm-void/llvm-001-musl.patch
Normal file
58
patches/llvm-void/llvm-001-musl.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Brancaleoni <miwaxe@gmail.com>
|
||||
Date: Tue, 8 Sep 2015 22:03:02 +0200
|
||||
Subject: [PATCH 3/3] musl
|
||||
|
||||
---
|
||||
include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
|
||||
lib/Support/DynamicLibrary.cpp | 2 +-
|
||||
lib/Support/Unix/Signals.inc | 6 +++---
|
||||
utils/unittest/googletest/src/gtest.cc | 1 +
|
||||
5 files changed, 17 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
|
||||
index e0a1ee3..465b65a 100644
|
||||
--- a/include/llvm/Analysis/TargetLibraryInfo.h
|
||||
+++ b/include/llvm/Analysis/TargetLibraryInfo.h
|
||||
@@ -18,6 +18,15 @@
|
||||
#include "llvm/IR/PassManager.h"
|
||||
#include "llvm/Pass.h"
|
||||
|
||||
+#undef fopen64
|
||||
+#undef fseeko64
|
||||
+#undef fstat64
|
||||
+#undef fstatvfs64
|
||||
+#undef ftello64
|
||||
+#undef lstat64
|
||||
+#undef stat64
|
||||
+#undef tmpfile64
|
||||
+
|
||||
namespace llvm {
|
||||
template <typename T> class ArrayRef;
|
||||
|
||||
diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
|
||||
index 5780764..1d548c1 100644
|
||||
--- a/utils/unittest/googletest/src/gtest.cc
|
||||
+++ b/utils/unittest/googletest/src/gtest.cc
|
||||
@@ -128,6 +128,7 @@
|
||||
|
||||
#if GTEST_CAN_STREAM_RESULTS_
|
||||
# include <arpa/inet.h> // NOLINT
|
||||
+# include <sys/socket.h> // NOLINT
|
||||
# include <netdb.h> // NOLINT
|
||||
# include <sys/socket.h> // NOLINT
|
||||
# include <sys/types.h> // NOLINT
|
||||
--
|
||||
2.5.1
|
||||
|
||||
--- a/lib/Support/Unix/DynamicLibrary.inc
|
||||
+++ b/lib/Support/Unix/DynamicLibrary.inc
|
||||
@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
|
||||
|
||||
// This macro returns the address of a well-known, explicit symbol
|
||||
#define EXPLICIT_SYMBOL(SYM) \
|
||||
- if (!strcmp(SymbolName, #SYM)) return &SYM
|
||||
+ if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
|
||||
|
||||
// Under glibc we have a weird situation. The stderr/out/in symbols are both
|
||||
// macros and global variables because of standards requirements. So, we
|
26
patches/llvm-void/llvm-002-musl-ppc64-elfv2.patch
Normal file
26
patches/llvm-void/llvm-002-musl-ppc64-elfv2.patch
Normal file
@ -0,0 +1,26 @@
|
||||
This patches LLVM to use ELFv2 on ppc64 uncoditionally unless overridden. We
|
||||
need this because unlike most distros we use ELFv2 for both glibc and musl
|
||||
on big endian ppc64.
|
||||
|
||||
--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
|
||||
+++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
|
||||
@@ -213,9 +213,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
|
||||
|
||||
switch (TT.getArch()) {
|
||||
case Triple::ppc64le:
|
||||
- return PPCTargetMachine::PPC_ABI_ELFv2;
|
||||
case Triple::ppc64:
|
||||
- return PPCTargetMachine::PPC_ABI_ELFv1;
|
||||
+ return PPCTargetMachine::PPC_ABI_ELFv2;
|
||||
default:
|
||||
return PPCTargetMachine::PPC_ABI_UNKNOWN;
|
||||
}
|
||||
--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
|
||||
+++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
|
||||
@@ -1,4 +1,5 @@
|
||||
-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
|
||||
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
|
||||
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
|
||||
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
|
||||
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
|
||||
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
|
11
patches/llvm-void/llvm-003-secureplt.patch
Normal file
11
patches/llvm-void/llvm-003-secureplt.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
|
||||
+++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
|
||||
@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
|
||||
|
||||
if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
|
||||
TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
|
||||
- TargetTriple.isMusl())
|
||||
+ isTargetLinux())
|
||||
SecurePlt = true;
|
||||
|
||||
if (HasSPE && IsPPC64)
|
18
patches/llvm-void/llvm-004-override-opt.patch
Normal file
18
patches/llvm-void/llvm-004-override-opt.patch
Normal file
@ -0,0 +1,18 @@
|
||||
This allows us to override the optimization level as not all platforms can
|
||||
deal with -O3.
|
||||
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -893,6 +893,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
|
||||
llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
|
||||
endif()
|
||||
|
||||
+set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
|
||||
+
|
||||
+if(NOT VOID_CXX_OPT_FLAGS STREQUAL "")
|
||||
+ llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
|
||||
+endif()
|
||||
+
|
||||
# Put this before tblgen. Else we have a circular dependence.
|
||||
add_subdirectory(lib/Demangle)
|
||||
add_subdirectory(lib/Support)
|
38
patches/llvm-void/llvm-005-ppc-bigpic.patch
Normal file
38
patches/llvm-void/llvm-005-ppc-bigpic.patch
Normal file
@ -0,0 +1,38 @@
|
||||
From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Holland <samuel@sholland.org>
|
||||
Date: Sun, 3 Nov 2019 10:57:27 -0600
|
||||
Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
|
||||
|
||||
---
|
||||
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 2 +-
|
||||
llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
|
||||
index 269b84b4e8d..03246a5242c 100644
|
||||
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
|
||||
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
|
||||
@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
|
||||
|
||||
// Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
|
||||
if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
|
||||
- M->getPICLevel() == PICLevel::BigPIC)
|
||||
+ M->getPICLevel() != PICLevel::SmallPIC)
|
||||
TlsRef = MCBinaryExpr::createAdd(
|
||||
TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
|
||||
const MachineOperand &MO = MI->getOperand(2);
|
||||
diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
|
||||
index 027e6bd1ba0..ae461f4eea9 100644
|
||||
--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
|
||||
+++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
|
||||
@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
|
||||
const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
|
||||
// If -msecure-plt -fPIC, add 32768 to symbol.
|
||||
if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
|
||||
- M->getPICLevel() == PICLevel::BigPIC &&
|
||||
+ M->getPICLevel() != PICLevel::SmallPIC &&
|
||||
MO.getTargetFlags() == PPCII::MO_PLT)
|
||||
Expr =
|
||||
MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
|
||||
--
|
||||
2.23.0
|
25
patches/llvm-void/llvm-006-aarch64-mf_exec.patch
Normal file
25
patches/llvm-void/llvm-006-aarch64-mf_exec.patch
Normal file
@ -0,0 +1,25 @@
|
||||
Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
|
||||
|
||||
Failing Tests (8):
|
||||
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
|
||||
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
|
||||
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
|
||||
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
|
||||
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
|
||||
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
|
||||
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
|
||||
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
|
||||
|
||||
Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
|
||||
|
||||
--- a/lib/Support/Unix/Memory.inc
|
||||
+++ b/lib/Support/Unix/Memory.inc
|
||||
@@ -59,7 +59,7 @@
|
||||
return PROT_READ | PROT_WRITE | PROT_EXEC;
|
||||
case llvm::sys::Memory::MF_EXEC:
|
||||
#if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
|
||||
- defined(_POWER) || defined(_ARCH_PPC))
|
||||
+ defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
|
||||
// On PowerPC, having an executable page that has no read permission
|
||||
// can have unintended consequences. The function InvalidateInstruction-
|
||||
// Cache uses instructions dcbf and icbi, both of which are treated by
|
86
patches/llvm-void/llvm-007-ppc-d85007.patch
Normal file
86
patches/llvm-void/llvm-007-ppc-d85007.patch
Normal file
@ -0,0 +1,86 @@
|
||||
From cf54ca458afff1f7827bfbbc939429a00496c4f7 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Stellard <tstellar@redhat.com>
|
||||
Date: Tue, 18 Aug 2020 10:54:49 -0700
|
||||
Subject: [PATCH] [PowerPC] PPCBoolRetToInt: Skip translation if there is
|
||||
ConstantExpr
|
||||
|
||||
PPCBoolRetToInt collects PHI, Argument, Call and Constant defs related to an `i1` value which later is translated to an `i32`/`i64` value. The `translate` method expects an `i1` value. However, if the `Constant` is a `ConstantExpr`, the type of the `ConstantExpr` 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 | 8 ++++--
|
||||
llvm/test/CodeGen/PowerPC/pr46923.ll | 31 +++++++++++++++++++++
|
||||
2 files changed, 37 insertions(+), 2 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 2259a29f838..cfe3b3ce2e9 100644
|
||||
--- llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp
|
||||
+++ llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp
|
||||
@@ -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());
|
||||
|
||||
@@ -227,8 +230,9 @@ class PPCBoolRetToInt : public FunctionPass {
|
||||
// CallInst. Potentially, bitwise operations (AND, OR, XOR, NOT) and sign
|
||||
// extension could also be handled in the future.
|
||||
for (Value *V : Defs)
|
||||
- if (!isa<PHINode>(V) && !isa<Constant>(V) &&
|
||||
- !isa<Argument>(V) && !isa<CallInst>(V))
|
||||
+ if ((!isa<PHINode>(V) && !isa<Constant>(V) && !isa<Argument>(V) &&
|
||||
+ !isa<CallInst>(V)) ||
|
||||
+ isa<ConstantExpr>(V))
|
||||
return false;
|
||||
|
||||
for (Value *V : Defs)
|
||||
diff --git a/llvm/test/CodeGen/PowerPC/pr46923.ll b/llvm/test/CodeGen/PowerPC/pr46923.ll
|
||||
new file mode 100644
|
||||
index 00000000000..d6f65508848
|
||||
--- /dev/null
|
||||
+++ llvm/test/CodeGen/PowerPC/pr46923.ll
|
||||
@@ -0,0 +1,31 @@
|
||||
+; 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: crxor 4*cr5+lt, 4*cr5+lt, 4*cr5+lt
|
||||
+; CHECK-NEXT: li r3, 0
|
||||
+; CHECK-NEXT: li r4, 1
|
||||
+; CHECK-NEXT: isel r3, r4, 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.18.1
|
||||
|
Reference in New Issue
Block a user