[llvm-branch-commits] [compiler-rt] fe9976c - Revert "[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl"
Author: Nico Weber Date: 2021-01-02T18:59:26-05:00 New Revision: fe9976c02c09f105751f787ec998abeb3414a235 URL: https://github.com/llvm/llvm-project/commit/fe9976c02c09f105751f787ec998abeb3414a235 DIFF: https://github.com/llvm/llvm-project/commit/fe9976c02c09f105751f787ec998abeb3414a235.diff LOG: Revert "[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl" ...and follow-ups. It still doesn't build on Android, see https://reviews.llvm.org/D93848#2476310 This reverts commit a92d01534f1c4fb79210975573e774d0393f2533. This reverts commit 52d7e183bf25ea38e1149e39e19d21e6212e701f. This reverts commit 34489da81b39972b40d2ff5581fe48911339406e. Added: Modified: compiler-rt/cmake/Modules/AddCompilerRT.cmake compiler-rt/lib/asan/asan_interceptors.h compiler-rt/lib/asan/tests/asan_test.cpp compiler-rt/lib/interception/interception_linux.cpp compiler-rt/lib/interception/interception_linux.h compiler-rt/lib/msan/tests/msan_test.cpp compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp compiler-rt/lib/sanitizer_common/sanitizer_platform.h compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp Removed: diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake index 361538a58e47..0b8db6a868a1 100644 --- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake +++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake @@ -583,7 +583,6 @@ macro(add_custom_libcxx name prefix) CMAKE_OBJDUMP CMAKE_STRIP CMAKE_SYSROOT -LIBCXX_HAS_MUSL_LIBC PYTHON_EXECUTABLE Python3_EXECUTABLE Python2_EXECUTABLE diff --git a/compiler-rt/lib/asan/asan_interceptors.h b/compiler-rt/lib/asan/asan_interceptors.h index 45cdb80b1b64..4266a31cecb9 100644 --- a/compiler-rt/lib/asan/asan_interceptors.h +++ b/compiler-rt/lib/asan/asan_interceptors.h @@ -60,7 +60,7 @@ void InitializePlatformInterceptors(); # define ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX 0 #endif -#if SANITIZER_GLIBC || SANITIZER_SOLARIS +#if (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_SOLARIS # define ASAN_INTERCEPT_SWAPCONTEXT 1 #else # define ASAN_INTERCEPT_SWAPCONTEXT 0 @@ -72,7 +72,7 @@ void InitializePlatformInterceptors(); # define ASAN_INTERCEPT_SIGLONGJMP 0 #endif -#if SANITIZER_GLIBC +#if SANITIZER_LINUX && !SANITIZER_ANDROID # define ASAN_INTERCEPT___LONGJMP_CHK 1 #else # define ASAN_INTERCEPT___LONGJMP_CHK 0 @@ -106,7 +106,7 @@ void InitializePlatformInterceptors(); # define ASAN_INTERCEPT_ATEXIT 0 #endif -#if SANITIZER_GLIBC +#if SANITIZER_LINUX && !SANITIZER_ANDROID # define ASAN_INTERCEPT___STRDUP 1 #else # define ASAN_INTERCEPT___STRDUP 0 diff --git a/compiler-rt/lib/asan/tests/asan_test.cpp b/compiler-rt/lib/asan/tests/asan_test.cpp index c0b79bba48ff..51a527359b49 100644 --- a/compiler-rt/lib/asan/tests/asan_test.cpp +++ b/compiler-rt/lib/asan/tests/asan_test.cpp @@ -804,7 +804,7 @@ char* MallocAndMemsetString(size_t size) { return MallocAndMemsetString(size, 'z'); } -#if SANITIZER_GLIBC +#if defined(__linux__) && !defined(__ANDROID__) #define READ_TEST(READ_N_BYTES) \ char *x = new char[10];\ int fd = open("/proc/self/stat", O_RDONLY);\ @@ -827,7 +827,7 @@ TEST(AddressSanitizer, pread64) { TEST(AddressSanitizer, read) { READ_TEST(read(fd, x, 15)); } -#endif // SANITIZER_GLIBC +#endif // defined(__linux__) && !defined(__ANDROID__) // This test case fails // Clang optimizes memcpy/memset calls which lead to unaligned access diff --git a/compiler-rt/lib/interception/interception_linux.cpp b/compiler-rt/lib/interception/interception_linux.cpp index 5111a87f0a6c..6883608d44f3 100644 --- a/compiler-rt/lib/interception/interception_linux.cpp +++ b/compiler-rt/lib/interception/interception_linux.cpp @@ -63,8 +63,8 @@ bool InterceptFunction(const char *name, uptr *ptr_to_real, uptr func, return addr && (func == wrapper); } -// dlvsym is a GNU extension supported by some other platforms. -#if SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD +// Android and Solaris do not have dlvsym +#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS static void *GetFuncAddr(const char *name, const char *ver) { return dlvsym(RTLD_NEXT, name, ver); } @@ -75,7 +75,7 @@ bool InterceptFunction(const char *name, const char *ver, uptr *ptr_to_real, *ptr_to_real = (uptr)addr; return addr && (func == wrapper); } -#endif // SANITIZER_GLIBC || SANITIZER_FREEBSD ||
[llvm-branch-commits] [llvm] a554cd6 - [RuntimeDyld] Fix dangling reference in RuntimeDyldELF.
Author: Lang Hames Date: 2021-01-03T10:20:36+11:00 New Revision: a554cd6ae5bc24627b959b00288754712879d822 URL: https://github.com/llvm/llvm-project/commit/a554cd6ae5bc24627b959b00288754712879d822 DIFF: https://github.com/llvm/llvm-project/commit/a554cd6ae5bc24627b959b00288754712879d822.diff LOG: [RuntimeDyld] Fix dangling reference in RuntimeDyldELF. Patch by Moritz Sichert. Thanks Moritz! Differential Revision: https://reviews.llvm.org/D89373 Added: Modified: llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Removed: diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp index dc396ae4c211..28e1faab5ac7 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp @@ -1670,30 +1670,33 @@ RuntimeDyldELF::processRelocationRef( if (Value.SymbolName) { // This is a call to an external function. // Look for an existing stub. -SectionEntry = Sections[SectionID]; +SectionEntry *Section = [SectionID]; StubMap::const_iterator i = Stubs.find(Value); uintptr_t StubAddress; if (i != Stubs.end()) { - StubAddress = uintptr_t(Section.getAddress()) + i->second; + StubAddress = uintptr_t(Section->getAddress()) + i->second; LLVM_DEBUG(dbgs() << " Stub function found\n"); } else { // Create a new stub function (equivalent to a PLT entry). LLVM_DEBUG(dbgs() << " Create a new stub function\n"); - uintptr_t BaseAddress = uintptr_t(Section.getAddress()); + uintptr_t BaseAddress = uintptr_t(Section->getAddress()); uintptr_t StubAlignment = getStubAlignment(); StubAddress = - (BaseAddress + Section.getStubOffset() + StubAlignment - 1) & + (BaseAddress + Section->getStubOffset() + StubAlignment - 1) & -StubAlignment; unsigned StubOffset = StubAddress - BaseAddress; Stubs[Value] = StubOffset; createStubFunction((uint8_t *)StubAddress); // Bump our stub offset counter - Section.advanceStubOffset(getMaxStubSize()); + Section->advanceStubOffset(getMaxStubSize()); // Allocate a GOT Entry uint64_t GOTOffset = allocateGOTEntries(1); + // This potentially creates a new Section which potentially + // invalidates the Section pointer, so reload it. + Section = [SectionID]; // The load of the GOT address has an addend of -4 resolveGOTOffsetRelocation(SectionID, StubOffset + 2, GOTOffset - 4, @@ -1706,7 +1709,7 @@ RuntimeDyldELF::processRelocationRef( } // Make the target call a call into the stub table. -resolveRelocation(Section, Offset, StubAddress, ELF::R_X86_64_PC32, +resolveRelocation(*Section, Offset, StubAddress, ELF::R_X86_64_PC32, Addend); } else { RelocationEntry RE(SectionID, Offset, ELF::R_X86_64_PC32, Value.Addend, ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 835bdd1 - [gn build] Port 5799fc79c3f
Author: LLVM GN Syncbot Date: 2021-01-02T22:46:43Z New Revision: 835bdd17761293486a63e6b38a94059ba48ac0fc URL: https://github.com/llvm/llvm-project/commit/835bdd17761293486a63e6b38a94059ba48ac0fc DIFF: https://github.com/llvm/llvm-project/commit/835bdd17761293486a63e6b38a94059ba48ac0fc.diff LOG: [gn build] Port 5799fc79c3f Added: Modified: llvm/utils/gn/secondary/llvm/tools/llvm-reduce/BUILD.gn Removed: diff --git a/llvm/utils/gn/secondary/llvm/tools/llvm-reduce/BUILD.gn b/llvm/utils/gn/secondary/llvm/tools/llvm-reduce/BUILD.gn index 7a3851e9732f..7bdae5e6d4e4 100644 --- a/llvm/utils/gn/secondary/llvm/tools/llvm-reduce/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/tools/llvm-reduce/BUILD.gn @@ -17,6 +17,7 @@ executable("llvm-reduce") { "deltas/ReduceBasicBlocks.cpp", "deltas/ReduceFunctionBodies.cpp", "deltas/ReduceFunctions.cpp", +"deltas/ReduceGlobalVarInitializers.cpp", "deltas/ReduceGlobalVars.cpp", "deltas/ReduceInstructions.cpp", "deltas/ReduceMetadata.cpp", ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 5fa241a - [SimplifyCFG] FoldValueComparisonIntoPredecessors(): fine-tune/fix DomTree preservation, take 2
Author: Roman Lebedev Date: 2021-01-03T01:45:48+03:00 New Revision: 5fa241a6571c79c1cd0c0d9e7f87e5e361e2dab4 URL: https://github.com/llvm/llvm-project/commit/5fa241a6571c79c1cd0c0d9e7f87e5e361e2dab4 DIFF: https://github.com/llvm/llvm-project/commit/5fa241a6571c79c1cd0c0d9e7f87e5e361e2dab4.diff LOG: [SimplifyCFG] FoldValueComparisonIntoPredecessors(): fine-tune/fix DomTree preservation, take 2 Added: Modified: llvm/lib/Transforms/Utils/SimplifyCFG.cpp llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase-2.ll Removed: diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 738e524fbfd9..d581c97f9fea 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1176,7 +1176,8 @@ bool SimplifyCFGOpt::FoldValueComparisonIntoPredecessors(Instruction *TI, // Reconstruct the new switch statement we will be building. if (PredDefault != BBDefault) { PredDefault->removePredecessor(Pred); - Updates.push_back({DominatorTree::Delete, Pred, PredDefault}); + if (PredDefault != BB) +Updates.push_back({DominatorTree::Delete, Pred, PredDefault}); PredDefault = BBDefault; NewSuccessors.push_back(BBDefault); } diff --git a/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase-2.ll b/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase-2.ll index 79857cccfbe4..a3f7ca5e1741 100644 --- a/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase-2.ll +++ b/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase-2.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -S -simplifycfg -simplifycfg-require-and-preserve-domtree=0 < %s | FileCheck %s +; RUN: opt -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s declare void @widget() declare i16 @baz() ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] a001393 - [NFC][SimplifyCFG] Add another test for switch creation where we fail to maintain DomTree
Author: Roman Lebedev Date: 2021-01-03T01:45:48+03:00 New Revision: a0013934b6a194f0ecc4d98118920326b12d07a0 URL: https://github.com/llvm/llvm-project/commit/a0013934b6a194f0ecc4d98118920326b12d07a0 DIFF: https://github.com/llvm/llvm-project/commit/a0013934b6a194f0ecc4d98118920326b12d07a0.diff LOG: [NFC][SimplifyCFG] Add another test for switch creation where we fail to maintain DomTree Added: llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase-2.ll Modified: Removed: diff --git a/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase-2.ll b/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase-2.ll new file mode 100644 index ..79857cccfbe4 --- /dev/null +++ b/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase-2.ll @@ -0,0 +1,80 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -S -simplifycfg -simplifycfg-require-and-preserve-domtree=0 < %s | FileCheck %s + +declare void @widget() +declare i16 @baz() +declare void @snork() +declare void @spam() + +define void @zot() local_unnamed_addr align 2 personality i8* undef { +; CHECK-LABEL: @zot( +; CHECK-NEXT: bb: +; CHECK-NEXT:invoke void @widget() +; CHECK-NEXT:to label [[BB14:%.*]] unwind label [[BB21:%.*]] +; CHECK: bb14: +; CHECK-NEXT:[[I0:%.*]] = invoke i16 @baz() +; CHECK-NEXT:to label [[BB15:%.*]] unwind label [[BB25:%.*]] +; CHECK: bb15: +; CHECK-NEXT:switch i16 [[I0]], label [[BB19:%.*]] [ +; CHECK-NEXT:i16 42, label [[BB23:%.*]] +; CHECK-NEXT:i16 21330, label [[BB23]] +; CHECK-NEXT:] +; CHECK: bb19: +; CHECK-NEXT:invoke void @snork() +; CHECK-NEXT:to label [[BB20:%.*]] unwind label [[BB25]] +; CHECK: bb20: +; CHECK-NEXT:unreachable +; CHECK: bb21: +; CHECK-NEXT:[[I22:%.*]] = landingpad { i8*, i32 } +; CHECK-NEXT:cleanup +; CHECK-NEXT:ret void +; CHECK: bb23: +; CHECK-NEXT:invoke void @spam() +; CHECK-NEXT:to label [[BB24:%.*]] unwind label [[BB25]] +; CHECK: bb24: +; CHECK-NEXT:ret void +; CHECK: bb25: +; CHECK-NEXT:[[I26:%.*]] = landingpad { i8*, i32 } +; CHECK-NEXT:cleanup +; CHECK-NEXT:br label [[BB24]] +; +bb: + invoke void @widget() + to label %bb14 unwind label %bb21 + +bb14: ; preds = %bb + %i0 = invoke i16 @baz() + to label %bb15 unwind label %bb25 + +bb15: ; preds = %bb14 + %i16 = icmp eq i16 %i0, 42 + br i1 %i16, label %bb23, label %bb17 + +bb17: ; preds = %bb15 + %i18 = icmp eq i16 %i0, 21330 + br i1 %i18, label %bb23, label %bb19 + +bb19: ; preds = %bb17 + invoke void @snork() + to label %bb20 unwind label %bb25 + +bb20: ; preds = %bb19 + unreachable + +bb21: ; preds = %bb + %i22 = landingpad { i8*, i32 } + cleanup + ret void + +bb23: ; preds = %bb17, %bb15 + invoke void @spam() + to label %bb24 unwind label %bb25 + +bb24: ; preds = %bb25, %bb23 + ret void + +bb25: ; preds = %bb23, %bb19, %bb14 + %i26 = landingpad { i8*, i32 } + cleanup + br label %bb24 +} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 6a3a8d1 - [SimplifyCFG] FoldValueComparisonIntoPredecessors(): fine-tune/fix DomTree preservation
Author: Roman Lebedev Date: 2021-01-03T01:45:48+03:00 New Revision: 6a3a8d17ebae0669e797ac22a2b2963b89ee12fa URL: https://github.com/llvm/llvm-project/commit/6a3a8d17ebae0669e797ac22a2b2963b89ee12fa DIFF: https://github.com/llvm/llvm-project/commit/6a3a8d17ebae0669e797ac22a2b2963b89ee12fa.diff LOG: [SimplifyCFG] FoldValueComparisonIntoPredecessors(): fine-tune/fix DomTree preservation Added: Modified: llvm/lib/Transforms/Utils/SimplifyCFG.cpp llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase.ll Removed: diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 825de4214c64..738e524fbfd9 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1113,8 +1113,6 @@ bool SimplifyCFGOpt::FoldValueComparisonIntoPredecessors(Instruction *TI, std::vector Updates; - Updates.push_back({DominatorTree::Delete, Pred, BB}); - // Figure out which 'cases' to copy from SI to PSI. std::vector BBCases; BasicBlock *BBDefault = GetValueEqualityComparisonCases(TI, BBCases); @@ -1303,10 +1301,10 @@ bool SimplifyCFGOpt::FoldValueComparisonIntoPredecessors(Instruction *TI, NewSI->setSuccessor(i, InfLoopBlock); } - if (InfLoopBlock) { -Updates.push_back({DominatorTree::Delete, Pred, BB}); + if (InfLoopBlock) Updates.push_back({DominatorTree::Insert, Pred, InfLoopBlock}); - } + + Updates.push_back({DominatorTree::Delete, Pred, BB}); if (DTU) DTU->applyUpdatesPermissive(Updates); diff --git a/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase.ll b/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase.ll index 0d7718b865b2..10c02515e9d1 100644 --- a/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase.ll +++ b/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -S -simplifycfg -simplifycfg-require-and-preserve-domtree=0 < %s | FileCheck %s +; RUN: opt -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s define dso_local i32 @readCBPandCoeffsFromNAL(i1 %c, i32 %x, i32 %y) local_unnamed_addr { ; CHECK-LABEL: @readCBPandCoeffsFromNAL( ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] eda5030 - [NFC][SimplifyCFG] Add test for switch creation where we fail to maintain DomTree
Author: Roman Lebedev Date: 2021-01-03T01:45:47+03:00 New Revision: eda50309f5930d249fef4747efb9a047d239ba05 URL: https://github.com/llvm/llvm-project/commit/eda50309f5930d249fef4747efb9a047d239ba05 DIFF: https://github.com/llvm/llvm-project/commit/eda50309f5930d249fef4747efb9a047d239ba05.diff LOG: [NFC][SimplifyCFG] Add test for switch creation where we fail to maintain DomTree Reduced from vanilla test-suite Added: llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase.ll Modified: Removed: diff --git a/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase.ll b/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase.ll new file mode 100644 index ..0d7718b865b2 --- /dev/null +++ b/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase.ll @@ -0,0 +1,49 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -S -simplifycfg -simplifycfg-require-and-preserve-domtree=0 < %s | FileCheck %s + +define dso_local i32 @readCBPandCoeffsFromNAL(i1 %c, i32 %x, i32 %y) local_unnamed_addr { +; CHECK-LABEL: @readCBPandCoeffsFromNAL( +; CHECK-NEXT: if.end: +; CHECK-NEXT:br i1 [[C:%.*]], label [[IF_END80:%.*]], label [[IF_THEN64:%.*]] +; CHECK: if.then64: +; CHECK-NEXT:[[MERGE:%.*]] = phi i32 [ [[Y:%.*]], [[IF_END:%.*]] ], [ 1, [[IF_END172237:%.*]] ], [ 0, [[IF_END80]] ], [ 0, [[IF_END80]] ] +; CHECK-NEXT:ret i32 [[MERGE]] +; CHECK: if.end80: +; CHECK-NEXT:switch i32 [[X:%.*]], label [[INFLOOP:%.*]] [ +; CHECK-NEXT:i32 10, label [[IF_END172237]] +; CHECK-NEXT:i32 14, label [[IF_END172237]] +; CHECK-NEXT:i32 9, label [[IF_THEN64]] +; CHECK-NEXT:i32 12, label [[IF_THEN64]] +; CHECK-NEXT:] +; CHECK: if.end172237: +; CHECK-NEXT:br label [[IF_THEN64]] +; CHECK: infloop: +; CHECK-NEXT:br label [[INFLOOP]] +; +if.end: + br i1 %c, label %if.end80, label %if.then64 + +if.then64:; preds = %if.end + ret i32 %y + +if.end80: ; preds = %if.end + switch i32 %x, label %lor.lhs.false89 [ + i32 10, label %if.end172237 + i32 14, label %if.end172237 + i32 9, label %if.end172 + ] + +lor.lhs.false89: ; preds = %lor.lhs.false89, %if.end80 + %cmp91 = icmp eq i32 %x, 12 + br i1 %cmp91, label %if.end172, label %lor.lhs.false89 + +if.end172:; preds = %lor.lhs.false89, %if.end80 + br label %if.end239 + +if.end172237: ; preds = %if.end80, %if.end80 + br label %if.end239 + +if.end239:; preds = %if.end172237, %if.end172 + %cbp.0 = phi i32 [ 1, %if.end172237 ], [ 0, %if.end172 ] + ret i32 %cbp.0 +} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 5799fc7 - [llvm-reduce] Refactor global variable delta pass
Author: Roman Lebedev Date: 2021-01-03T01:45:47+03:00 New Revision: 5799fc79c3fdbc81dd421afae38197009ad605c9 URL: https://github.com/llvm/llvm-project/commit/5799fc79c3fdbc81dd421afae38197009ad605c9 DIFF: https://github.com/llvm/llvm-project/commit/5799fc79c3fdbc81dd421afae38197009ad605c9.diff LOG: [llvm-reduce] Refactor global variable delta pass The limitation of the current pass that it skips initializer-less GV's seems arbitrary, in all the reduced cases i (personally) looked at, the globals weren't needed, yet they were kept. So let's do two things: 1. allow reducing initializer-less globals 2. before reducing globals, reduce their initializers, much like we do function bodies Added: llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.cpp llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.h Modified: llvm/test/Reduce/remove-global-vars.ll llvm/tools/llvm-reduce/CMakeLists.txt llvm/tools/llvm-reduce/DeltaManager.h llvm/tools/llvm-reduce/deltas/ReduceGlobalVars.cpp llvm/tools/llvm-reduce/deltas/ReduceGlobalVars.h Removed: llvm/test/Reduce/Inputs/remove-global-vars.py diff --git a/llvm/test/Reduce/Inputs/remove-global-vars.py b/llvm/test/Reduce/Inputs/remove-global-vars.py deleted file mode 100755 index 1ae8b0e6e76c.. --- a/llvm/test/Reduce/Inputs/remove-global-vars.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python - -import sys - -InterestingVar = 0 - -input = open(sys.argv[1], "r") -for line in input: - i = line.find(';') - if i >= 0: -line = line[:i] - if line.startswith("@interesting = global") or "@interesting" in line: -InterestingVar += 1 - -if InterestingVar == 4: - sys.exit(0) # interesting! - -sys.exit(1) diff --git a/llvm/test/Reduce/remove-global-vars.ll b/llvm/test/Reduce/remove-global-vars.ll index 4fca4a1e6973..d078cad6b995 100644 --- a/llvm/test/Reduce/remove-global-vars.ll +++ b/llvm/test/Reduce/remove-global-vars.ll @@ -1,24 +1,47 @@ ; Test that llvm-reduce can remove uninteresting Global Variables as well as ; their direct uses (which in turn are replaced with 'undef'). -; -; RUN: llvm-reduce --test %python --test-arg %p/Inputs/remove-global-vars.py %s -o %t -; RUN: cat %t | FileCheck -implicit-check-not=uninteresting %s -; CHECK: @interesting = global +; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t +; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL --implicit-check-not=uninteresting %s + +; CHECK-INTERESTINGNESS: @interesting = {{.*}}global i32{{.*}}, align 4 +; CHECK-INTERESTINGNESS: @interesting2 = global i32 0, align 4 +; CHECK-INTERESTINGNESS: @interesting3 = {{.*}}global i32{{.*}}, align 4 + +; CHECK-FINAL: @interesting = external global i32, align 4 +; CHECK-FINAL: @interesting2 = global i32 0, align 4 +; CHECK-FINAL: @interesting3 = external global i32, align 4 @interesting = global i32 0, align 4 +@interesting2 = global i32 0, align 4 +@interesting3 = external global i32, align 4 @uninteresting = global i32 1, align 4 +@uninteresting2 = external global i32, align 4 define i32 @main() { entry: %0 = load i32, i32* @uninteresting, align 4 - ; CHECK: store i32 undef, i32* @interesting, align 4 + + ; CHECK-INTERESTINGNESS: store i32 {{.*}}, i32* @interesting, align 4 + ; CHECK-FINAL: store i32 undef, i32* @interesting, align 4 store i32 %0, i32* @interesting, align 4 - ; CHECK: load i32, i32* @interesting, align 4 + ; CHECK-INTERESTINGNESS: store i32 {{.*}}, i32* @interesting3, align 4 + ; CHECK-FINAL: store i32 undef, i32* @interesting3, align 4 + store i32 %0, i32* @interesting3, align 4 + + ; CHECK-ALL: load i32, i32* @interesting, align 4 %1 = load i32, i32* @interesting, align 4 store i32 %1, i32* @uninteresting, align 4 - ; CHECK: store i32 5, i32* @interesting, align 4 + ; CHECK-ALL: load i32, i32* @interesting3, align 4 + %2 = load i32, i32* @interesting3, align 4 + store i32 %2, i32* @uninteresting2, align 4 + + ; CHECK-ALL: store i32 5, i32* @interesting, align 4 store i32 5, i32* @interesting, align 4 + + ; CHECK-ALL: store i32 5, i32* @interesting3, align 4 + store i32 5, i32* @interesting3, align 4 + ret i32 0 } diff --git a/llvm/tools/llvm-reduce/CMakeLists.txt b/llvm/tools/llvm-reduce/CMakeLists.txt index 3d635d178a71..b6db920e01bf 100644 --- a/llvm/tools/llvm-reduce/CMakeLists.txt +++ b/llvm/tools/llvm-reduce/CMakeLists.txt @@ -19,6 +19,7 @@ add_llvm_tool(llvm-reduce deltas/ReduceBasicBlocks.cpp deltas/ReduceFunctionBodies.cpp deltas/ReduceFunctions.cpp + deltas/ReduceGlobalVarInitializers.cpp deltas/ReduceGlobalVars.cpp deltas/ReduceInstructions.cpp deltas/ReduceMetadata.cpp diff --git a/llvm/tools/llvm-reduce/DeltaManager.h b/llvm/tools/llvm-reduce/DeltaManager.h index 9c18da9793e7..18a6b0d363c4 100644
[llvm-branch-commits] [llvm] 19ab181 - [llvm-reduce] Fix removal of unused llvm intrinsics declarations
Author: Roman Lebedev Date: 2021-01-03T01:45:47+03:00 New Revision: 19ab1817b61d3b716f69f78f727de8bd8887f53f URL: https://github.com/llvm/llvm-project/commit/19ab1817b61d3b716f69f78f727de8bd8887f53f DIFF: https://github.com/llvm/llvm-project/commit/19ab1817b61d3b716f69f78f727de8bd8887f53f.diff LOG: [llvm-reduce] Fix removal of unused llvm intrinsics declarations ee6e25e4391a6d3ac0a3c89615474e512f44cda6 changed the delta pass to skip intrinsics, which means we may end up being left with declarations of intrinsics, that aren't otherwise referenced in the module. This is obviously unwanted, do drop them. Added: llvm/test/Reduce/remove-unused-declarations.ll Modified: llvm/tools/llvm-reduce/deltas/ReduceFunctions.cpp Removed: diff --git a/llvm/test/Reduce/remove-unused-declarations.ll b/llvm/test/Reduce/remove-unused-declarations.ll new file mode 100644 index ..5ae3a3edbad0 --- /dev/null +++ b/llvm/test/Reduce/remove-unused-declarations.ll @@ -0,0 +1,21 @@ +; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t +; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL --implicit-check-not=uninteresting %s + +declare void @llvm.uninteresting() +declare void @uninteresting() + +; CHECK-ALL: declare void @llvm.interesting() +; CHECK-ALL: declare void @interesting() +declare void @llvm.interesting() +declare void @interesting() + +; CHECK-ALL: define void @main() { +; CHECK-ALL-NEXT: call void @llvm.interesting() +; CHECK-ALL-NEXT: call void @interesting() +; CHECK-ALL-NEXT: ret void +; CHECK-ALL-NEXT: } +define void @main() { + call void @llvm.interesting() + call void @interesting() + ret void +} diff --git a/llvm/tools/llvm-reduce/deltas/ReduceFunctions.cpp b/llvm/tools/llvm-reduce/deltas/ReduceFunctions.cpp index 6bb8f81c3dbd..d100935ee422 100644 --- a/llvm/tools/llvm-reduce/deltas/ReduceFunctions.cpp +++ b/llvm/tools/llvm-reduce/deltas/ReduceFunctions.cpp @@ -33,8 +33,8 @@ static void extractFunctionsFromModule(const std::vector , [](Function ) { // Intrinsics don't have function bodies that are useful to // reduce. Additionally, intrinsics may have additional operand -// constraints. -return !F.isIntrinsic() && !O.shouldKeep(); +// constraints. But, do drop intrinsics that are not referenced. +return (!F.isIntrinsic() || F.use_empty()) && !O.shouldKeep(); }); // Then, drop body of each of them. We want to batch this and do nothing else @@ -51,7 +51,7 @@ static void extractFunctionsFromModule(const std::vector , } } -/// Counts the amount of non-declaration functions and prints their +/// Counts the amount of functions and prints their /// respective name & index static int countFunctions(Module *Program) { // TODO: Silence index with --quiet flag @@ -59,7 +59,7 @@ static int countFunctions(Module *Program) { errs() << "Function Index Reference:\n"; int FunctionCount = 0; for (auto : *Program) { -if (F.isIntrinsic()) +if (F.isIntrinsic() && !F.use_empty()) continue; errs() << '\t' << ++FunctionCount << ": " << F.getName() << '\n'; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 7c8b806 - [SimplifyCFG][AMDGPU] AMDGPUUnifyDivergentExitNodes: SimplifyCFG isn't ready to preserve PostDomTree
Author: Roman Lebedev Date: 2021-01-03T01:45:46+03:00 New Revision: 7c8b8063b66c7b936d41a0c4069c506669e13115 URL: https://github.com/llvm/llvm-project/commit/7c8b8063b66c7b936d41a0c4069c506669e13115 DIFF: https://github.com/llvm/llvm-project/commit/7c8b8063b66c7b936d41a0c4069c506669e13115.diff LOG: [SimplifyCFG][AMDGPU] AMDGPUUnifyDivergentExitNodes: SimplifyCFG isn't ready to preserve PostDomTree There is a number of transforms in SimplifyCFG that take DomTree out of DomTreeUpdater, and do updates manually. Until they are fixed, user passes are unable to claim that PDT is preserved. Note that the default for SimplifyCFG is still not to preserve DomTree, so this is still effectively NFC. Added: Modified: llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp llvm/lib/Transforms/Utils/SimplifyCFG.cpp Removed: diff --git a/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp b/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp index 96de1bd8f8d1..9ea8b3265b0d 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp @@ -89,7 +89,7 @@ void AMDGPUUnifyDivergentExitNodes::getAnalysisUsage(AnalysisUsage ) const{ if (RequireAndPreserveDomTree) { AU.addPreserved(); -AU.addPreserved(); +// FIXME: preserve PostDominatorTreeWrapperPass } // No divergent values are changed, only blocks and branch edges. @@ -369,7 +369,8 @@ bool AMDGPUUnifyDivergentExitNodes::runOnFunction(Function ) { } } - DomTreeUpdater DTU(DT, , DomTreeUpdater::UpdateStrategy::Eager); + // FIXME: add PDT here once simplifycfg is ready. + DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Eager); if (RequireAndPreserveDomTree) DTU.applyUpdates(Updates); Updates.clear(); diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index e1f7ef636a89..825de4214c64 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -263,7 +263,11 @@ class SimplifyCFGOpt { const DataLayout , SmallPtrSetImpl *LoopHeaders, const SimplifyCFGOptions ) - : TTI(TTI), DTU(DTU), DL(DL), LoopHeaders(LoopHeaders), Options(Opts) {} + : TTI(TTI), DTU(DTU), DL(DL), LoopHeaders(LoopHeaders), Options(Opts) { +assert((!DTU || !DTU->hasPostDomTree()) && + "SimplifyCFG is not yet capable of maintaining validity of a " + "PostDomTree, so don't ask for it."); + } bool simplifyOnce(BasicBlock *BB); bool simplifyOnceImpl(BasicBlock *BB); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 01f0d16 - Moving UniqueInternalLinkageNamesPass to the start of IR pipelines.
Author: Hongtao Yu Date: 2021-01-02T14:26:21-08:00 New Revision: 01f0d162d672c02b7207e0b3a6c494c4d0ea513d URL: https://github.com/llvm/llvm-project/commit/01f0d162d672c02b7207e0b3a6c494c4d0ea513d DIFF: https://github.com/llvm/llvm-project/commit/01f0d162d672c02b7207e0b3a6c494c4d0ea513d.diff LOG: Moving UniqueInternalLinkageNamesPass to the start of IR pipelines. `UniqueInternalLinkageNamesPass` is useful to CSSPGO, especially when pseudo probe is used. It solves naming conflict for static functions which otherwise will share a merged profile and likely have a profile quality issue with mismatched CFG checksums. Since the pseudo probe instrumentation happens very early in the pipeline, I'm moving `UniqueInternalLinkageNamesPass` right before it. This is being done only to the new pass manager. Reviewed By: dblaikie, aeubanks Differential Revision: https://reviews.llvm.org/D93656 Added: llvm/test/Other/new-pm-pseudo-probe.ll llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll Modified: llvm/include/llvm/Passes/PassBuilder.h llvm/lib/Passes/PassBuilder.cpp llvm/tools/opt/NewPMDriver.cpp Removed: diff --git a/llvm/include/llvm/Passes/PassBuilder.h b/llvm/include/llvm/Passes/PassBuilder.h index 5a13df5b0c86..fdd4474a8ff0 100644 --- a/llvm/include/llvm/Passes/PassBuilder.h +++ b/llvm/include/llvm/Passes/PassBuilder.h @@ -127,6 +127,9 @@ class PipelineTuningOptions { /// Tuning option to enable/disable function merging. Its default value is /// false. bool MergeFunctions; + + /// Uniquefy function linkage name. Its default value is false. + bool UniqueLinkageNames; }; /// This class provides access to building LLVM's passes. diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index dad40a2f540f..95f58d9e3f73 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -285,6 +285,7 @@ PipelineTuningOptions::PipelineTuningOptions() { LicmMssaNoAccForPromotionCap = SetLicmMssaNoAccForPromotionCap; CallGraphProfile = true; MergeFunctions = false; + UniqueLinkageNames = false; } extern cl::opt EnableConstraintElimination; @@ -1003,6 +1004,11 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level, ThinLTOPhase Phase) { ModulePassManager MPM(DebugLogging); + // Add UniqueInternalLinkageNames Pass which renames internal linkage + // symbols with unique names. + if (PTO.UniqueLinkageNames) +MPM.addPass(UniqueInternalLinkageNamesPass()); + // Place pseudo probe instrumentation as the first pass of the pipeline to // minimize the impact of optimization changes. if (PGOOpt && PGOOpt->PseudoProbeForProfiling && @@ -1773,6 +1779,11 @@ ModulePassManager PassBuilder::buildO0DefaultPipeline(OptimizationLevel Level, ModulePassManager MPM(DebugLogging); + // Add UniqueInternalLinkageNames Pass which renames internal linkage + // symbols with unique names. + if (PTO.UniqueLinkageNames) +MPM.addPass(UniqueInternalLinkageNamesPass()); + if (PGOOpt && (PGOOpt->Action == PGOOptions::IRInstr || PGOOpt->Action == PGOOptions::IRUse)) addPGOInstrPassesForO0( diff --git a/llvm/test/Other/new-pm-pseudo-probe.ll b/llvm/test/Other/new-pm-pseudo-probe.ll new file mode 100644 index ..4d3f20556f2c --- /dev/null +++ b/llvm/test/Other/new-pm-pseudo-probe.ll @@ -0,0 +1,12 @@ +; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s +; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s +; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s +; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s + +define void @foo() { + ret void +} + +;; Check the SampleProfileProbePass is enabled under the -new-pm-pseudo-probe-for-profiling switch. +;; The switch can be used to test a specific pass order in a particular setup, e.g, in unique-internal-linkage-names.ll +; CHECK: Running pass: SampleProfileProbePass diff --git a/llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll b/llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll new file mode 100644 index ..716009dbd0cc --- /dev/null +++ b/llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll @@ -0,0 +1,24 @@ +; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O0 --check-prefix=UNIQUE +; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names
[llvm-branch-commits] [clang-tools-extra] 7af6a13 - [NFC] Switch up some dyn_cast calls
Author: Nathan James Date: 2021-01-02T19:56:27Z New Revision: 7af6a134508cd1c7f75c6e3441ce436f220f30a4 URL: https://github.com/llvm/llvm-project/commit/7af6a134508cd1c7f75c6e3441ce436f220f30a4 DIFF: https://github.com/llvm/llvm-project/commit/7af6a134508cd1c7f75c6e3441ce436f220f30a4.diff LOG: [NFC] Switch up some dyn_cast calls Added: Modified: clang-tools-extra/clangd/AST.cpp clang-tools-extra/clangd/DumpAST.cpp clang-tools-extra/clangd/FindTarget.cpp clang-tools-extra/clangd/refactor/Rename.cpp clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp clang-tools-extra/clangd/refactor/tweaks/SwapIfBranches.cpp Removed: diff --git a/clang-tools-extra/clangd/AST.cpp b/clang-tools-extra/clangd/AST.cpp index c5f87af86319..39ab48843b28 100644 --- a/clang-tools-extra/clangd/AST.cpp +++ b/clang-tools-extra/clangd/AST.cpp @@ -367,7 +367,7 @@ class DeducedTypeVisitor : public RecursiveASTVisitor { // Loc of auto in return type (c++14). auto CurLoc = D->getReturnTypeSourceRange().getBegin(); // Loc of "auto" in operator auto() -if (CurLoc.isInvalid() && dyn_cast(D)) +if (CurLoc.isInvalid() && isa(D)) CurLoc = D->getTypeSourceInfo()->getTypeLoc().getBeginLoc(); // Loc of "auto" in function with trailing return type (c++11). if (CurLoc.isInvalid()) diff --git a/clang-tools-extra/clangd/DumpAST.cpp b/clang-tools-extra/clangd/DumpAST.cpp index 12698b42ef3e..588bcfcf2424 100644 --- a/clang-tools-extra/clangd/DumpAST.cpp +++ b/clang-tools-extra/clangd/DumpAST.cpp @@ -242,9 +242,8 @@ class DumpVisitor : public RecursiveASTVisitor { return "const"; return ""; } -if (isa(S) || isa(S) || -isa(S) || isa(S) || -isa(S) || isa(S)) +if (isa(S)) return toString([&](raw_ostream ) { S->printPretty(OS, nullptr, Ctx.getPrintingPolicy()); }); diff --git a/clang-tools-extra/clangd/FindTarget.cpp b/clang-tools-extra/clangd/FindTarget.cpp index 3afd65522680..9a502a84e36f 100644 --- a/clang-tools-extra/clangd/FindTarget.cpp +++ b/clang-tools-extra/clangd/FindTarget.cpp @@ -843,7 +843,7 @@ llvm::SmallVector refInStmt(const Stmt *S) { void VisitMemberExpr(const MemberExpr *E) { // Skip destructor calls to avoid duplication: TypeLoc within will be // visited separately. - if (llvm::dyn_cast(E->getFoundDecl().getDecl())) + if (llvm::isa(E->getFoundDecl().getDecl())) return; Refs.push_back(ReferenceLoc{E->getQualifierLoc(), E->getMemberNameInfo().getLoc(), diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp index 8ed5811c88b2..d3c7da96a441 100644 --- a/clang-tools-extra/clangd/refactor/Rename.cpp +++ b/clang-tools-extra/clangd/refactor/Rename.cpp @@ -119,7 +119,7 @@ const NamedDecl *canonicalRenameDecl(const NamedDecl *D) { // declaration. while (Method->isVirtual() && Method->size_overridden_methods()) Method = *Method->overridden_methods().begin(); -return dyn_cast(Method->getCanonicalDecl()); +return Method->getCanonicalDecl(); } if (const auto *Function = dyn_cast(D)) if (const FunctionTemplateDecl *Template = Function->getPrimaryTemplate()) diff --git a/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp b/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp index c214695c5f07..cb87cc764bc3 100644 --- a/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp +++ b/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp @@ -111,7 +111,7 @@ Expected ExpandAutoType::apply(const Selection& Inputs) { // if it's a lambda expression, return an error message if (isa(*DeducedType) && - dyn_cast(*DeducedType)->getDecl()->isLambda()) { + cast(*DeducedType)->getDecl()->isLambda()) { return error("Could not expand type of lambda expression"); } diff --git a/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp b/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp index bcf9bbe00f7c..c603861c3d69 100644 --- a/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp +++ b/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp @@ -79,7 +79,7 @@ computeReferencedDecls(const clang::Expr *Expr) { } }; FindDeclRefsVisitor Visitor; - Visitor.TraverseStmt(const_cast(dyn_cast(Expr))); + Visitor.TraverseStmt(const_cast(cast(Expr))); return Visitor.ReferencedDecls; } diff --git a/clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp b/clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp index 25fab244e30c..35d8605d 100644 ---
[llvm-branch-commits] [clang] 4c77a0f - [PowerPC] NFC: Apply minor clang-format fix
Author: Brandon Bergren Date: 2021-01-02T12:21:28-06:00 New Revision: 4c77a0f1ce6f950805f567ff6505f7c18e62e288 URL: https://github.com/llvm/llvm-project/commit/4c77a0f1ce6f950805f567ff6505f7c18e62e288 DIFF: https://github.com/llvm/llvm-project/commit/4c77a0f1ce6f950805f567ff6505f7c18e62e288.diff LOG: [PowerPC] NFC: Apply minor clang-format fix Added: Modified: clang/lib/Driver/ToolChains/Linux.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp index 74d4c245aa74..9663a7390ada 100644 --- a/clang/lib/Driver/ToolChains/Linux.cpp +++ b/clang/lib/Driver/ToolChains/Linux.cpp @@ -198,8 +198,7 @@ static StringRef getOSLibDir(const llvm::Triple , const ArgList ) { // FIXME: This is a bit of a hack. We should really unify this code for // reasoning about oslibdir spellings with the lib dir spellings in the // GCCInstallationDetector, but that is a more significant refactoring. - if (Triple.getArch() == llvm::Triple::x86 || - Triple.isPPC32() || + if (Triple.getArch() == llvm::Triple::x86 || Triple.isPPC32() || Triple.getArch() == llvm::Triple::sparc) return "lib32"; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 2288319 - [PowerPC] Enable OpenMP for powerpcle target. [5/5]
Author: Brandon Bergren Date: 2021-01-02T12:18:07-06:00 New Revision: 2288319733cd5f525bf7e24dece08bfcf9d0ff9e URL: https://github.com/llvm/llvm-project/commit/2288319733cd5f525bf7e24dece08bfcf9d0ff9e DIFF: https://github.com/llvm/llvm-project/commit/2288319733cd5f525bf7e24dece08bfcf9d0ff9e.diff LOG: [PowerPC] Enable OpenMP for powerpcle target. [5/5] Enable OpenMP for powerpcle to match the rest of powerpc*. Update tests. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D92445 Added: Modified: clang/test/Driver/ppc-features.cpp llvm/include/llvm/Frontend/OpenMP/OMPKinds.def llvm/lib/Frontend/OpenMP/OMPContext.cpp Removed: diff --git a/clang/test/Driver/ppc-features.cpp b/clang/test/Driver/ppc-features.cpp index df0b6c6ddc13..05d71b95dba7 100644 --- a/clang/test/Driver/ppc-features.cpp +++ b/clang/test/Driver/ppc-features.cpp @@ -167,6 +167,7 @@ // OpenMP features // RUN: %clang -target powerpc-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s +// RUN: %clang -target powerpcle-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s // CHECK_OPENMP_TLS-NOT: "-fnoopenmp-use-tls" diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def index 6d0db8f5f57f..0cb29b245c97 100644 --- a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def +++ b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def @@ -1033,6 +1033,7 @@ __OMP_TRAIT_PROPERTY(device, arch, aarch64) __OMP_TRAIT_PROPERTY(device, arch, aarch64_be) __OMP_TRAIT_PROPERTY(device, arch, aarch64_32) __OMP_TRAIT_PROPERTY(device, arch, ppc) +__OMP_TRAIT_PROPERTY(device, arch, ppcle) __OMP_TRAIT_PROPERTY(device, arch, ppc64) __OMP_TRAIT_PROPERTY(device, arch, ppc64le) __OMP_TRAIT_PROPERTY(device, arch, x86) diff --git a/llvm/lib/Frontend/OpenMP/OMPContext.cpp b/llvm/lib/Frontend/OpenMP/OMPContext.cpp index 56a6e2b08bd9..e252c964e647 100644 --- a/llvm/lib/Frontend/OpenMP/OMPContext.cpp +++ b/llvm/lib/Frontend/OpenMP/OMPContext.cpp @@ -40,6 +40,7 @@ OMPContext::OMPContext(bool IsDeviceCompilation, Triple TargetTriple) { case Triple::mips64: case Triple::mips64el: case Triple::ppc: + case Triple::ppcle: case Triple::ppc64: case Triple::ppc64le: case Triple::x86: ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] 275eb82 - [PowerPC] Support powerpcle target in LLD [4/5]
Author: Brandon Bergren Date: 2021-01-02T12:18:05-06:00 New Revision: 275eb8289c43665bc4ce873535f9960322d16c07 URL: https://github.com/llvm/llvm-project/commit/275eb8289c43665bc4ce873535f9960322d16c07 DIFF: https://github.com/llvm/llvm-project/commit/275eb8289c43665bc4ce873535f9960322d16c07.diff LOG: [PowerPC] Support powerpcle target in LLD [4/5] Add support for linking powerpcle code in LLD. Rewrite lld/test/ELF/emulation-ppc.s to use a shared check block and add powerpcle tests. Update tests. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D93917 Added: Modified: lld/ELF/Driver.cpp lld/ELF/InputFiles.cpp lld/ELF/ScriptParser.cpp lld/test/ELF/emulation-ppc.s lld/test/ELF/ppc32-gnu-ifunc.s lld/test/ELF/ppc32-reloc-rel.s Removed: diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 3eaa893a3ff5..5cc32f81c2ec 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -152,6 +152,7 @@ static std::tuple parseEmulation(StringRef emul) { .Cases("elf32ltsmip", "elf32ltsmipn32", {ELF32LEKind, EM_MIPS}) .Case("elf32lriscv", {ELF32LEKind, EM_RISCV}) .Cases("elf32ppc", "elf32ppclinux", {ELF32BEKind, EM_PPC}) + .Cases("elf32lppc", "elf32lppclinux", {ELF32LEKind, EM_PPC}) .Case("elf64btsmip", {ELF64BEKind, EM_MIPS}) .Case("elf64ltsmip", {ELF64LEKind, EM_MIPS}) .Case("elf64lriscv", {ELF64LEKind, EM_RISCV}) diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 3ff93c85617c..a23491d62dc8 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -1621,6 +1621,7 @@ static uint16_t getBitcodeMachineKind(StringRef path, const Triple ) { case Triple::msp430: return EM_MSP430; case Triple::ppc: + case Triple::ppcle: return EM_PPC; case Triple::ppc64: case Triple::ppc64le: diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index 82b98e5ddebe..b81812d11821 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -413,6 +413,7 @@ static std::pair parseBfdName(StringRef s) { .Case("elf64-aarch64", {ELF64LEKind, EM_AARCH64}) .Case("elf64-littleaarch64", {ELF64LEKind, EM_AARCH64}) .Case("elf32-powerpc", {ELF32BEKind, EM_PPC}) + .Case("elf32-powerpcle", {ELF32LEKind, EM_PPC}) .Case("elf64-powerpc", {ELF64BEKind, EM_PPC64}) .Case("elf64-powerpcle", {ELF64LEKind, EM_PPC64}) .Case("elf64-x86-64", {ELF64LEKind, EM_X86_64}) diff --git a/lld/test/ELF/emulation-ppc.s b/lld/test/ELF/emulation-ppc.s index def78a521b20..004eb23b9c66 100644 --- a/lld/test/ELF/emulation-ppc.s +++ b/lld/test/ELF/emulation-ppc.s @@ -1,144 +1,106 @@ # REQUIRES: ppc # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %tppc64 # RUN: ld.lld -m elf64ppc %tppc64 -o %t2ppc64 -# RUN: llvm-readobj --file-headers %t2ppc64 | FileCheck --check-prefix=PPC64 %s +# RUN: llvm-readobj --file-headers %t2ppc64 | FileCheck --check-prefixes=CHECK,PPC64,LINUX,PPCBE %s # RUN: ld.lld %tppc64 -o %t3ppc64 -# RUN: llvm-readobj --file-headers %t3ppc64 | FileCheck --check-prefix=PPC64 %s +# RUN: llvm-readobj --file-headers %t3ppc64 | FileCheck --check-prefixes=CHECK,PPC64,LINUX,PPCBE %s # RUN: echo 'OUTPUT_FORMAT(elf64-powerpc)' > %tppc64.script # RUN: ld.lld %tppc64.script %tppc64 -o %t4ppc64 -# RUN: llvm-readobj --file-headers %t4ppc64 | FileCheck --check-prefix=PPC64 %s - -# PPC64: ElfHeader { -# PPC64-NEXT: Ident { -# PPC64-NEXT: Magic: (7F 45 4C 46) -# PPC64-NEXT: Class: 64-bit (0x2) -# PPC64-NEXT: DataEncoding: BigEndian (0x2) -# PPC64-NEXT: FileVersion: 1 -# PPC64-NEXT: OS/ABI: SystemV (0x0) -# PPC64-NEXT: ABIVersion: 0 -# PPC64-NEXT: Unused: (00 00 00 00 00 00 00) -# PPC64-NEXT: } -# PPC64-NEXT: Type: Executable (0x2) -# PPC64-NEXT: Machine: EM_PPC64 (0x15) -# PPC64-NEXT: Version: 1 -# PPC64-NEXT: Entry: -# PPC64-NEXT: ProgramHeaderOffset: 0x40 -# PPC64-NEXT: SectionHeaderOffset: -# PPC64-NEXT: Flags [ (0x2) -# PPC64-NEXT: 0x2 -# PPC64-NEXT: ] -# PPC64-NEXT: HeaderSize: 64 -# PPC64-NEXT: ProgramHeaderEntrySize: 56 -# PPC64-NEXT: ProgramHeaderCount: -# PPC64-NEXT: SectionHeaderEntrySize: 64 -# PPC64-NEXT: SectionHeaderCount: -# PPC64-NEXT: StringTableSectionIndex: -# PPC64-NEXT: } - -# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-freebsd %s -o %tppc64fbsd -# RUN: echo 'OUTPUT_FORMAT(elf64-powerpc-freebsd)' > %tppc64fbsd.script -# RUN: ld.lld %tppc64fbsd.script %tppc64fbsd -o %t2ppc64fbsd -# RUN: llvm-readobj --file-headers %t2ppc64fbsd | FileCheck --check-prefix=PPC64-FBSD %s - -# PPC64-FBSD: ElfHeader { -# PPC64-FBSD-NEXT: Ident { -# PPC64-FBSD-NEXT: Magic: (7F 45 4C 46) -# PPC64-FBSD-NEXT: Class: 64-bit (0x2) -# PPC64-FBSD-NEXT: DataEncoding: BigEndian (0x2) -# PPC64-FBSD-NEXT: FileVersion: 1 -#
[llvm-branch-commits] [clang] 6cee9d0 - [PowerPC] Support powerpcle target in Clang [3/5]
Author: Brandon Bergren Date: 2021-01-02T12:17:58-06:00 New Revision: 6cee9d0cf896d83fa8f87b7f8d67ae2dfdbc1bf9 URL: https://github.com/llvm/llvm-project/commit/6cee9d0cf896d83fa8f87b7f8d67ae2dfdbc1bf9 DIFF: https://github.com/llvm/llvm-project/commit/6cee9d0cf896d83fa8f87b7f8d67ae2dfdbc1bf9.diff LOG: [PowerPC] Support powerpcle target in Clang [3/5] Add powerpcle support to clang. For FreeBSD, assume a freestanding environment for now, as we only need it in the first place to build loader, which runs in the OpenFirmware environment instead of the FreeBSD environment. For Linux, recognize glibc and musl environments to match current usage in Void Linux PPC. Adjust driver to match current binutils behavior regarding machine naming. Adjust and expand tests. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D93919 Added: Modified: clang/lib/Basic/Targets.cpp clang/lib/Basic/Targets/OSTargets.h clang/lib/Basic/Targets/PPC.cpp clang/lib/Basic/Targets/PPC.h clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/TargetInfo.cpp clang/lib/Driver/Driver.cpp clang/lib/Driver/ToolChain.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Driver/ToolChains/CommonArgs.cpp clang/lib/Driver/ToolChains/FreeBSD.cpp clang/lib/Driver/ToolChains/Gnu.cpp clang/lib/Driver/ToolChains/Linux.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Sema/SemaChecking.cpp clang/test/CodeGen/altivec.c clang/test/CodeGen/builtins-ppc-altivec.c clang/test/CodeGen/ppc32-and-aix-struct-return.c clang/test/CodeGen/target-data.c clang/test/Driver/linux-header-search.cpp clang/test/Driver/ppc-endian.c clang/test/Driver/ppc-features.cpp Removed: diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 1126b647e37b..e88d90a98395 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -334,6 +334,16 @@ TargetInfo *AllocateTarget(const llvm::Triple , return new PPC32TargetInfo(Triple, Opts); } + case llvm::Triple::ppcle: +switch (os) { +case llvm::Triple::Linux: + return new LinuxTargetInfo(Triple, Opts); +case llvm::Triple::FreeBSD: + return new FreeBSDTargetInfo(Triple, Opts); +default: + return new PPC32TargetInfo(Triple, Opts); +} + case llvm::Triple::ppc64: if (Triple.isOSDarwin()) return new DarwinPPC64TargetInfo(Triple, Opts); diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index 0d5d6f553093..67fa1a537fea 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -253,6 +253,7 @@ class LLVM_LIBRARY_VISIBILITY FreeBSDTargetInfo : public OSTargetInfo { case llvm::Triple::mips: case llvm::Triple::mipsel: case llvm::Triple::ppc: +case llvm::Triple::ppcle: case llvm::Triple::ppc64: case llvm::Triple::ppc64le: this->MCountName = "_mcount"; @@ -413,6 +414,7 @@ class LLVM_LIBRARY_VISIBILITY LinuxTargetInfo : public OSTargetInfo { case llvm::Triple::mips64: case llvm::Triple::mips64el: case llvm::Triple::ppc: +case llvm::Triple::ppcle: case llvm::Triple::ppc64: case llvm::Triple::ppc64le: this->MCountName = "_mcount"; diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp index a6997324acf9..2be7555102f8 100644 --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -92,7 +92,8 @@ void PPCTargetInfo::getTargetDefines(const LangOptions , } // Target properties. - if (getTriple().getArch() == llvm::Triple::ppc64le) { + if (getTriple().getArch() == llvm::Triple::ppc64le || + getTriple().getArch() == llvm::Triple::ppcle) { Builder.defineMacro("_LITTLE_ENDIAN"); } else { if (!getTriple().isOSNetBSD() && diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h index a4677cd067f7..56c8f33ef221 100644 --- a/clang/lib/Basic/Targets/PPC.h +++ b/clang/lib/Basic/Targets/PPC.h @@ -355,6 +355,8 @@ class LLVM_LIBRARY_VISIBILITY PPC32TargetInfo : public PPCTargetInfo { : PPCTargetInfo(Triple, Opts) { if (Triple.isOSAIX()) resetDataLayout("E-m:a-p:32:32-i64:64-n32"); +else if (Triple.getArch() == llvm::Triple::ppcle) + resetDataLayout("e-m:e-p:32:32-i64:64-n32"); else resetDataLayout("E-m:e-p:32:32-i64:64-n32"); diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 6e4c31be84c1..6e98af407a9a 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -5041,6 +5041,7 @@ static Value *EmitTargetArchBuiltinExpr(CodeGenFunction *CGF, case llvm::Triple::x86_64: return CGF->EmitX86BuiltinExpr(BuiltinID, E); case llvm::Triple::ppc: + case llvm::Triple::ppcle: case llvm::Triple::ppc64: case
[llvm-branch-commits] [llvm] 696bd30 - [PowerPC] Support powerpcle target in LLVMObject [2/5]
Author: Brandon Bergren Date: 2021-01-02T12:17:39-06:00 New Revision: 696bd3073fd2fb5b01b88115bddff394c4b44ad5 URL: https://github.com/llvm/llvm-project/commit/696bd3073fd2fb5b01b88115bddff394c4b44ad5 DIFF: https://github.com/llvm/llvm-project/commit/696bd3073fd2fb5b01b88115bddff394c4b44ad5.diff LOG: [PowerPC] Support powerpcle target in LLVMObject [2/5] Add object file handling for powerpcle-*-*. Adjust tests. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D93916 Added: Modified: llvm/include/llvm/Object/ELFObjectFile.h llvm/lib/Object/RelocationResolver.cpp llvm/test/tools/llvm-objcopy/ELF/binary-output-target.test llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test llvm/test/tools/llvm-objdump/ELF/PowerPC/branch-offset.s llvm/unittests/Object/ELFObjectFileTest.cpp Removed: diff --git a/llvm/include/llvm/Object/ELFObjectFile.h b/llvm/include/llvm/Object/ELFObjectFile.h index 33b4c28db951..fed53eef68c3 100644 --- a/llvm/include/llvm/Object/ELFObjectFile.h +++ b/llvm/include/llvm/Object/ELFObjectFile.h @@ -1160,7 +1160,7 @@ StringRef ELFObjectFile::getFileFormatName() const { case ELF::EM_MSP430: return "elf32-msp430"; case ELF::EM_PPC: - return "elf32-powerpc"; + return (IsLittleEndian ? "elf32-powerpcle" : "elf32-powerpc"); case ELF::EM_RISCV: return "elf32-littleriscv"; case ELF::EM_CSKY: @@ -1236,7 +1236,7 @@ template Triple::ArchType ELFObjectFile::getArch() const { case ELF::EM_MSP430: return Triple::msp430; case ELF::EM_PPC: -return Triple::ppc; +return IsLittleEndian ? Triple::ppcle : Triple::ppc; case ELF::EM_PPC64: return IsLittleEndian ? Triple::ppc64le : Triple::ppc64; case ELF::EM_RISCV: diff --git a/llvm/lib/Object/RelocationResolver.cpp b/llvm/lib/Object/RelocationResolver.cpp index 52c4979c93f6..204577af7239 100644 --- a/llvm/lib/Object/RelocationResolver.cpp +++ b/llvm/lib/Object/RelocationResolver.cpp @@ -687,6 +687,7 @@ getRelocationResolver(const ObjectFile ) { switch (Obj.getArch()) { case Triple::x86: return {supportsX86, resolveX86}; +case Triple::ppcle: case Triple::ppc: return {supportsPPC32, resolvePPC32}; case Triple::arm: diff --git a/llvm/test/tools/llvm-objcopy/ELF/binary-output-target.test b/llvm/test/tools/llvm-objcopy/ELF/binary-output-target.test index f7073f07911c..78fc1435518c 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/binary-output-target.test +++ b/llvm/test/tools/llvm-objcopy/ELF/binary-output-target.test @@ -15,8 +15,17 @@ # RUN: llvm-objcopy -I binary -O elf32-bigmips %t.txt %t.mips.o # RUN: llvm-readobj --file-headers %t.mips.o | FileCheck %s --check-prefixes=CHECK,BE,MIPS,32 +# RUN: llvm-objcopy -I binary -O elf32-powerpc %t.txt %t.ppc32be.o +# RUN: llvm-readobj --file-headers %t.ppc32be.o | FileCheck %s --check-prefixes=CHECK,BE,PPC32,PPC32BE,32 + +# RUN: llvm-objcopy -I binary -O elf32-powerpcle %t.txt %t.ppc32le.o +# RUN: llvm-readobj --file-headers %t.ppc32le.o | FileCheck %s --check-prefixes=CHECK,LE,PPC32,PPC32LE,32 + +# RUN: llvm-objcopy -I binary -O elf64-powerpc %t.txt %t.ppc64be.o +# RUN: llvm-readobj --file-headers %t.ppc64be.o | FileCheck %s --check-prefixes=CHECK,BE,PPC64,PPC64BE,64 + # RUN: llvm-objcopy -I binary -O elf64-powerpcle %t.txt %t.ppc64le.o -# RUN: llvm-readobj --file-headers %t.ppc64le.o | FileCheck %s --check-prefixes=CHECK,LE,PPC64,64 +# RUN: llvm-readobj --file-headers %t.ppc64le.o | FileCheck %s --check-prefixes=CHECK,LE,PPC64,PPC64LE,64 # RUN: llvm-objcopy -I binary -O elf32-littleriscv %t.txt %t.rv32.o # RUN: llvm-readobj --file-headers %t.rv32.o | FileCheck %s --check-prefixes=CHECK,LE,RISCV32,32 @@ -43,8 +52,8 @@ # MIPS-SAME:mips{{$}} # RISCV32-SAME: riscv{{$}} # RISCV64-SAME: riscv{{$}} -# PPC-SAME: powerpc{{$}} -# PPC64le-SAME: powerpc{{$}} +# PPCBE-SAME: powerpc{{$}} +# PPCLE-SAME: powerpcle{{$}} # SPARC-SAME: sparc # SPARCEL-SAME: sparc # X86-64-SAME: x86-64 @@ -54,8 +63,10 @@ # HEXAGON-NEXT: Arch: hexagon # I386-NEXT:Arch: i386 # MIPS-NEXT:Arch: mips{{$}} -# PPC-NEXT: Arch: powerpc{{$}} -# PPC64-NEXT: Arch: powerpc64le +# PPC32BE-NEXT: Arch: powerpc{{$}} +# PPC32LE-NEXT: Arch: powerpcle{{$}} +# PPC64BE-NEXT: Arch: powerpc64{{$}} +# PPC64LE-NEXT: Arch: powerpc64le{{$}} # RISCV32-NEXT: Arch: riscv32 # RISCV64-NEXT: Arch: riscv64 # SPARC-NEXT: Arch: sparc{{$}} @@ -87,7 +98,7 @@ # HEXAGON-NEXT: Machine: EM_HEXAGON (0xA4) # I386-NEXT: Machine: EM_386 (0x3) # MIPS-NEXT: Machine: EM_MIPS (0x8) -# PPC-NEXT: Machine: EM_PPC (0x14) +# PPC32-NEXT: Machine: EM_PPC (0x14) # PPC64-NEXT: Machine: EM_PPC64 (0x15) # RISCV32-NEXT: Machine: EM_RISCV (0xF3) # RISCV64-NEXT: Machine: EM_RISCV (0xF3) diff --git a/llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test
[llvm-branch-commits] [llvm] 8f00447 - [PowerPC] Add the LLVM triple for powerpcle [1/5]
Author: Brandon Bergren Date: 2021-01-02T12:17:22-06:00 New Revision: 8f004471c2a50f0bc03731ebec32aa30de68b61f URL: https://github.com/llvm/llvm-project/commit/8f004471c2a50f0bc03731ebec32aa30de68b61f DIFF: https://github.com/llvm/llvm-project/commit/8f004471c2a50f0bc03731ebec32aa30de68b61f.diff LOG: [PowerPC] Add the LLVM triple for powerpcle [1/5] Add a triple for powerpcle-*-*. This is a little-endian encoding of the 32-bit PowerPC ABI, useful in certain niche situations: 1) A loader such as the FreeBSD loader which will be loading a little endian kernel. This is required for PowerPC64LE to load properly in pseries VMs. Such a loader is implemented as a freestanding ELF32 LSB binary. 2) Userspace emulation of a 32-bit LE architecture such as x86 on 64-bit hosts such as PowerPC64LE with tools like box86 requires having a 32-bit LE toolchain and library set, as they operate by translating only the main binary and switching to native code when making library calls. 3) The Void Linux for PowerPC project is experimenting with running an entire powerpcle userland. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D93918 Added: Modified: llvm/cmake/config.guess llvm/include/llvm/ADT/Triple.h llvm/lib/CodeGen/TargetLoweringBase.cpp llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp llvm/lib/Support/Triple.cpp llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp llvm/lib/Target/PowerPC/PPCSubtarget.cpp llvm/lib/Target/PowerPC/PPCTargetMachine.cpp llvm/lib/Target/PowerPC/TargetInfo/PowerPCTargetInfo.cpp llvm/lib/Target/PowerPC/TargetInfo/PowerPCTargetInfo.h llvm/unittests/ADT/TripleTest.cpp Removed: diff --git a/llvm/cmake/config.guess b/llvm/cmake/config.guess index 9fdfcce8d033..60d3f588d6f7 100644 --- a/llvm/cmake/config.guess +++ b/llvm/cmake/config.guess @@ -973,6 +973,9 @@ EOF ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; +ppcle:Linux:*:*) + echo powerpcle-unknown-linux-gnu + exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) LIBC=gnu eval $set_cc_for_build diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h index 6e2957f3c32b..f6f015577351 100644 --- a/llvm/include/llvm/ADT/Triple.h +++ b/llvm/include/llvm/ADT/Triple.h @@ -64,6 +64,7 @@ class Triple { mips64el, // MIPS64EL: mips64el, mips64r6el, mipsn32el, mipsn32r6el msp430, // MSP430: msp430 ppc,// PPC: powerpc +ppcle, // PPCLE: powerpc (little endian) ppc64, // PPC64: powerpc64, ppu ppc64le,// PPC64LE: powerpc64le r600, // R600: AMD GPUs HD2XXX - HD6XXX @@ -745,6 +746,17 @@ class Triple { return isMIPS32() || isMIPS64(); } + /// Tests whether the target is PowerPC (32- or 64-bit LE or BE). + bool isPPC() const { +return getArch() == Triple::ppc || getArch() == Triple::ppc64 || + getArch() == Triple::ppcle || getArch() == Triple::ppc64le; + } + + /// Tests whether the target is 32-bit PowerPC (little and big endian). + bool isPPC32() const { +return getArch() == Triple::ppc || getArch() == Triple::ppcle; + } + /// Tests whether the target is 64-bit PowerPC (little and big endian). bool isPPC64() const { return getArch() == Triple::ppc64 || getArch() == Triple::ppc64le; diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp index 5797006c76fb..6cacb10ab79f 100644 --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -135,7 +135,7 @@ void TargetLoweringBase::InitLibcalls(const Triple ) { setLibcallCallingConv((RTLIB::Libcall)LC, CallingConv::C); // For IEEE quad-precision libcall names, PPC uses "kf" instead of "tf". - if (TT.getArch() == Triple::ppc || TT.isPPC64()) { + if (TT.isPPC()) { setLibcallName(RTLIB::ADD_F128, "__addkf3"); setLibcallName(RTLIB::SUB_F128, "__subkf3"); setLibcallName(RTLIB::MUL_F128, "__mulkf3"); diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 65673d82..7bc5c98b89bc 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -128,6 +128,7 @@ void TargetLoweringObjectFileELF::Initialize(MCContext , // Fallthrough if not using EHABI LLVM_FALLTHROUGH; case Triple::ppc: + case Triple::ppcle: case Triple::x86: PersonalityEncoding = isPositionIndependent()
[llvm-branch-commits] [lldb] d5317b4 - [Process/NetBSD] Copy changes from FreeBSDRemote and reformat
Author: Michał Górny Date: 2021-01-02T19:15:12+01:00 New Revision: d5317b41c5857df4d4b2a382abcd58b81d2dcb18 URL: https://github.com/llvm/llvm-project/commit/d5317b41c5857df4d4b2a382abcd58b81d2dcb18 DIFF: https://github.com/llvm/llvm-project/commit/d5317b41c5857df4d4b2a382abcd58b81d2dcb18.diff LOG: [Process/NetBSD] Copy changes from FreeBSDRemote and reformat Copy changes, including: - NativeProcessNetBSD::GetLoadedModuleFileSpec() and NativeProcessNetBSD::GetFileLoadAddress() methods - split x86 register sets by CPU extensions - use offset/size-based register reading/writing Differential Revision: https://reviews.llvm.org/D93541 Added: Modified: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h lldb/test/API/python_api/lldbutil/iter/TestRegistersIterator.py lldb/test/API/tools/lldb-server/TestLldbGdbServer.py lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py Removed: diff --git a/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp b/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp index 75d0d0a37fae..57f0eb3cceb6 100644 --- a/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp +++ b/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp @@ -213,7 +213,7 @@ void NativeProcessNetBSD::MonitorSIGTRAP(lldb::pid_t pid) { LLDB_LOG(log, "got SIGTRAP, pid = {0}, lwpid = {1}, si_code = {2}", pid, info.psi_lwpid, info.psi_siginfo.si_code); - NativeThreadNetBSD* thread = nullptr; + NativeThreadNetBSD *thread = nullptr; if (info.psi_lwpid > 0) { for (const auto : m_threads) { @@ -224,8 +224,7 @@ void NativeProcessNetBSD::MonitorSIGTRAP(lldb::pid_t pid) { static_cast(t.get())->SetStoppedWithNoReason(); } if (!thread) - LLDB_LOG(log, - "thread not found in m_threads, pid = {0}, LWP = {1}", pid, + LLDB_LOG(log, "thread not found in m_threads, pid = {0}, LWP = {1}", pid, info.psi_lwpid); } @@ -266,30 +265,27 @@ void NativeProcessNetBSD::MonitorSIGTRAP(lldb::pid_t pid) { } switch (pst.pe_report_event) { - case PTRACE_LWP_CREATE: { -LLDB_LOG(log, - "monitoring new thread, pid = {0}, LWP = {1}", pid, - pst.pe_lwp); -NativeThreadNetBSD& t = AddThread(pst.pe_lwp); -error = t.CopyWatchpointsFrom( -static_cast(*GetCurrentThread())); -if (error.Fail()) { - LLDB_LOG(log, - "failed to copy watchpoints to new thread {0}: {1}", - pst.pe_lwp, error); - SetState(StateType::eStateInvalid); - return; -} - } break; - case PTRACE_LWP_EXIT: -LLDB_LOG(log, - "removing exited thread, pid = {0}, LWP = {1}", pid, - pst.pe_lwp); -RemoveThread(pst.pe_lwp); -break; +case PTRACE_LWP_CREATE: { + LLDB_LOG(log, "monitoring new thread, pid = {0}, LWP = {1}", pid, + pst.pe_lwp); + NativeThreadNetBSD = AddThread(pst.pe_lwp); + error = t.CopyWatchpointsFrom( + static_cast(*GetCurrentThread())); + if (error.Fail()) { +LLDB_LOG(log, "failed to copy watchpoints to new thread {0}: {1}", + pst.pe_lwp, error); +SetState(StateType::eStateInvalid); +return; + } +} break; +case PTRACE_LWP_EXIT: + LLDB_LOG(log, "removing exited thread, pid = {0}, LWP = {1}", pid, + pst.pe_lwp); + RemoveThread(pst.pe_lwp); + break; } -error = PtraceWrapper(PT_CONTINUE, pid, reinterpret_cast(1), 0); +error = PtraceWrapper(PT_CONTINUE, pid, reinterpret_cast(1), 0); if (error.Fail()) SetState(StateType::eStateInvalid); return; @@ -301,12 +297,13 @@ void NativeProcessNetBSD::MonitorSIGTRAP(lldb::pid_t pid) { auto = static_cast( thread->GetRegisterContext()); uint32_t wp_index = LLDB_INVALID_INDEX32; -Status error = regctx.GetWatchpointHitIndex(wp_index, -(uintptr_t)info.psi_siginfo.si_addr); +Status error = regctx.GetWatchpointHitIndex( +wp_index, (uintptr_t)info.psi_siginfo.si_addr); if (error.Fail()) LLDB_LOG(log, "received error while checking for watchpoint hits, pid = " - "{0}, LWP = {1}, error = {2}", pid, info.psi_lwpid, error); + "{0}, LWP = {1}, error = {2}", + pid, info.psi_lwpid, error); if (wp_index != LLDB_INVALID_INDEX32) { thread->SetStoppedByWatchpoint(wp_index); regctx.ClearWatchpointHit(wp_index); @@ -494,16 +491,14 @@ Status
[llvm-branch-commits] [lldb] d9ba814 - [lldb/test] Deduplicate the rest of TestLldbGdbServer.py
Author: Pavel Labath Date: 2021-01-02T18:32:25+01:00 New Revision: d9ba8142c9a44a025c9816a8dc4a015ad8baec6a URL: https://github.com/llvm/llvm-project/commit/d9ba8142c9a44a025c9816a8dc4a015ad8baec6a DIFF: https://github.com/llvm/llvm-project/commit/d9ba8142c9a44a025c9816a8dc4a015ad8baec6a.diff LOG: [lldb/test] Deduplicate the rest of TestLldbGdbServer.py Added: Modified: lldb/test/API/tools/lldb-server/TestLldbGdbServer.py Removed: diff --git a/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py b/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py index 58df3212f653..e92b056d3b09 100644 --- a/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py +++ b/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py @@ -505,26 +505,26 @@ def Hc_then_Csignal_signals_correct_thread(self, segfault_signo): post_handle_thread_id = int(post_handle_thread_id, 16) self.assertEqual(post_handle_thread_id, print_thread_id) -@expectedFailure -@debugserver_test -def test_Hc_then_Csignal_signals_correct_thread_launch_debugserver(self): -self.build() -self.set_inferior_startup_launch() -# Darwin debugserver translates some signals like SIGSEGV into some gdb -# expectations about fixed signal numbers. -self.Hc_then_Csignal_signals_correct_thread(self.TARGET_EXC_BAD_ACCESS) - +@expectedFailureDarwin @skipIfWindows # no SIGSEGV support @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr48419") @expectedFailureNetBSD -@llgs_test -def test_Hc_then_Csignal_signals_correct_thread_launch_llgs(self): +def test_Hc_then_Csignal_signals_correct_thread_launch(self): self.build() self.set_inferior_startup_launch() -self.Hc_then_Csignal_signals_correct_thread( -lldbutil.get_signal_number('SIGSEGV')) -def m_packet_reads_memory(self): +if self.platformIsDarwin(): +# Darwin debugserver translates some signals like SIGSEGV into some gdb +# expectations about fixed signal numbers. + self.Hc_then_Csignal_signals_correct_thread(self.TARGET_EXC_BAD_ACCESS) +else: +self.Hc_then_Csignal_signals_correct_thread( +lldbutil.get_signal_number('SIGSEGV')) + +@skipIfWindows # No pty support to test any inferior output +def test_m_packet_reads_memory(self): +self.build() +self.set_inferior_startup_launch() # This is the memory we will write into the inferior and then ensure we # can read back with $m. MEMORY_CONTENTS = "Test contents 0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz" @@ -576,20 +576,9 @@ def m_packet_reads_memory(self): read_contents = seven.unhexlify(context.get("read_contents")) self.assertEqual(read_contents, MEMORY_CONTENTS) -@debugserver_test -def test_m_packet_reads_memory_debugserver(self): +def test_qMemoryRegionInfo_is_supported(self): self.build() self.set_inferior_startup_launch() -self.m_packet_reads_memory() - -@skipIfWindows # No pty support to test any inferior output -@llgs_test -def test_m_packet_reads_memory_llgs(self): -self.build() -self.set_inferior_startup_launch() -self.m_packet_reads_memory() - -def qMemoryRegionInfo_is_supported(self): # Start up the inferior. procs = self.prep_debug_monitor_and_inferior() @@ -600,19 +589,11 @@ def qMemoryRegionInfo_is_supported(self): ], True) self.expect_gdbremote_sequence() -@debugserver_test -def test_qMemoryRegionInfo_is_supported_debugserver(self): -self.build() -self.set_inferior_startup_launch() -self.qMemoryRegionInfo_is_supported() - -@llgs_test -def test_qMemoryRegionInfo_is_supported_llgs(self): +@skipIfWindows # No pty support to test any inferior output +def test_qMemoryRegionInfo_reports_code_address_as_executable(self): self.build() self.set_inferior_startup_launch() -self.qMemoryRegionInfo_is_supported() -def qMemoryRegionInfo_reports_code_address_as_executable(self): # Start up the inferior. procs = self.prep_debug_monitor_and_inferior( inferior_args=["get-code-address-hex:hello", "sleep:5"]) @@ -660,21 +641,11 @@ def qMemoryRegionInfo_reports_code_address_as_executable(self): # Ensure the start address and size encompass the address we queried. self.assert_address_within_memory_region(code_address, mem_region_dict) -@debugserver_test -def test_qMemoryRegionInfo_reports_code_address_as_executable_debugserver( -self): -self.build() -self.set_inferior_startup_launch() -self.qMemoryRegionInfo_reports_code_address_as_executable() -
[llvm-branch-commits] [lldb] 54a1c86 - [lldb] Deduplicate more lldb-server tests
Author: Pavel Labath Date: 2021-01-02T18:32:25+01:00 New Revision: 54a1c861ca7a9e15d23904e1e702ac7e868882b0 URL: https://github.com/llvm/llvm-project/commit/54a1c861ca7a9e15d23904e1e702ac7e868882b0 DIFF: https://github.com/llvm/llvm-project/commit/54a1c861ca7a9e15d23904e1e702ac7e868882b0.diff LOG: [lldb] Deduplicate more lldb-server tests Use auto-generation of lldb-server variants. Added: Modified: lldb/test/API/tools/lldb-server/TestGdbRemote_vCont.py lldb/test/API/tools/lldb-server/TestGdbRemote_vContThreads.py lldb/test/API/tools/lldb-server/commandline/TestStubSetSID.py lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py Removed: diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemote_vCont.py b/lldb/test/API/tools/lldb-server/TestGdbRemote_vCont.py index e622932e19e0..6f12f8901666 100644 --- a/lldb/test/API/tools/lldb-server/TestGdbRemote_vCont.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemote_vCont.py @@ -1,10 +1,8 @@ - import gdbremote_testcase from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil - class TestGdbRemote_vCont(gdbremote_testcase.GdbRemoteTestCaseBase): mydir = TestBase.compute_mydir(__file__) @@ -26,100 +24,34 @@ def vCont_supports_mode(self, mode, inferior_args=None): # Verify we support the given mode. self.assertTrue(mode in supported_vCont_modes) -def vCont_supports_c(self): -self.vCont_supports_mode("c") - -def vCont_supports_C(self): -self.vCont_supports_mode("C") - -def vCont_supports_s(self): -self.vCont_supports_mode("s") - -def vCont_supports_S(self): -self.vCont_supports_mode("S") - -@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") -@debugserver_test -def test_vCont_supports_c_debugserver(self): -self.build() -self.vCont_supports_c() - -@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") -@llgs_test -def test_vCont_supports_c_llgs(self): -self.build() -self.vCont_supports_c() - -@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") -@debugserver_test -def test_vCont_supports_C_debugserver(self): -self.build() -self.vCont_supports_C() -@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") -@llgs_test -def test_vCont_supports_C_llgs(self): +def test_vCont_supports_c(self): self.build() -self.vCont_supports_C() - -@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") -@debugserver_test -def test_vCont_supports_s_debugserver(self): -self.build() -self.vCont_supports_s() - -@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") -@llgs_test -def test_vCont_supports_s_llgs(self): -self.build() -self.vCont_supports_s() +self.vCont_supports_mode("c") -@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") -@debugserver_test -def test_vCont_supports_S_debugserver(self): +def test_vCont_supports_C(self): self.build() -self.vCont_supports_S() +self.vCont_supports_mode("C") -@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") -@llgs_test -def test_vCont_supports_S_llgs(self): +def test_vCont_supports_s(self): self.build() -self.vCont_supports_S() +self.vCont_supports_mode("s") -@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") -@debugserver_test -def test_single_step_only_steps_one_instruction_with_Hc_vCont_s_debugserver( -self): +def test_vCont_supports_S(self): self.build() -self.set_inferior_startup_launch() -self.single_step_only_steps_one_instruction( -use_Hc_packet=True, step_instruction="vCont;s") +self.vCont_supports_mode("S") @skipIfWindows # No pty support to test O* & I* notification packets. -@llgs_test @skipIf(triple='^mips') -@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://27005337") -def test_single_step_only_steps_one_instruction_with_Hc_vCont_s_llgs(self): +def test_single_step_only_steps_one_instruction_with_Hc_vCont_s(self): self.build() self.set_inferior_startup_launch() self.single_step_only_steps_one_instruction( use_Hc_packet=True, step_instruction="vCont;s") -
[llvm-branch-commits] [llvm] 171c5fd - [llvm] Use llvm::erase_value and llvm::erase_if (NFC)
Author: Kazu Hirata Date: 2021-01-02T09:24:15-08:00 New Revision: 171c5fd43ecf46d5798b402c8cafccab07060e10 URL: https://github.com/llvm/llvm-project/commit/171c5fd43ecf46d5798b402c8cafccab07060e10 DIFF: https://github.com/llvm/llvm-project/commit/171c5fd43ecf46d5798b402c8cafccab07060e10.diff LOG: [llvm] Use llvm::erase_value and llvm::erase_if (NFC) Added: Modified: llvm/lib/CodeGen/WinEHPrepare.cpp llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp llvm/tools/llvm-yaml-parser-fuzzer/yaml-parser-fuzzer.cpp Removed: diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index 5a25234ba850..96d256ba57a3 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -804,13 +804,9 @@ void WinEHPrepare::cloneCommonBlocks(Function ) { << "\' to block \'" << NewBlock->getName() << "\'.\n"); - BlocksInFunclet.erase( - std::remove(BlocksInFunclet.begin(), BlocksInFunclet.end(), OldBlock), - BlocksInFunclet.end()); + llvm::erase_value(BlocksInFunclet, OldBlock); ColorVector = BlockColors[OldBlock]; - OldColors.erase( - std::remove(OldColors.begin(), OldColors.end(), FuncletPadBB), - OldColors.end()); + llvm::erase_value(OldColors, FuncletPadBB); DEBUG_WITH_TYPE("winehprepare-coloring", dbgs() << " Removed color \'" << FuncletPadBB->getName() diff --git a/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp b/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp index 39945ac3b1c1..b6763fd9aef0 100644 --- a/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp +++ b/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp @@ -997,7 +997,7 @@ OperandMatchResultTy HexagonAsmParser::tryParseRegister(unsigned , NeededWorkaround = NeededWorkaround || (Again && !(Contigious && Type)); } std::string Collapsed = std::string(RawString); - Collapsed.erase(llvm::remove_if(Collapsed, isSpace), Collapsed.end()); + llvm::erase_if(Collapsed, isSpace); StringRef FullString = Collapsed; std::pair DotSplit = FullString.split('.'); unsigned DotReg = matchRegister(DotSplit.first.lower()); diff --git a/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp b/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp index 3f50d60bc12c..7ffc75e66a52 100644 --- a/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp +++ b/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp @@ -39,7 +39,7 @@ inline bool isNumericRegex(llvm::StringRef S) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { std::string Input(reinterpret_cast(Data), Size); - Input.erase(std::remove(Input.begin(), Input.end(), 0), Input.end()); + llvm::erase_value(Input, 0); if (!Input.empty() && llvm::yaml::isNumeric(Input) != isNumericRegex(Input)) LLVM_BUILTIN_TRAP; return 0; diff --git a/llvm/tools/llvm-yaml-parser-fuzzer/yaml-parser-fuzzer.cpp b/llvm/tools/llvm-yaml-parser-fuzzer/yaml-parser-fuzzer.cpp index 3aeaf02f3e75..007769fd047a 100644 --- a/llvm/tools/llvm-yaml-parser-fuzzer/yaml-parser-fuzzer.cpp +++ b/llvm/tools/llvm-yaml-parser-fuzzer/yaml-parser-fuzzer.cpp @@ -25,7 +25,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { isValidYaml(Input.data(), Input.size()); // Ensure we don't crash on byte strings with no null characters. - Input.erase(std::remove(Input.begin(), Input.end(), 0), Input.end()); + llvm::erase_value(Input, 0); Input.shrink_to_fit(); bool IsValidWithout0s = isValidYaml(Input.data(), Input.size()); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 530c5af - [Transforms] Construct SmallVector with iterator ranges (NFC)
Author: Kazu Hirata Date: 2021-01-02T09:24:17-08:00 New Revision: 530c5af6a4810b54b6a82e4cbf0575ac67722cc9 URL: https://github.com/llvm/llvm-project/commit/530c5af6a4810b54b6a82e4cbf0575ac67722cc9 DIFF: https://github.com/llvm/llvm-project/commit/530c5af6a4810b54b6a82e4cbf0575ac67722cc9.diff LOG: [Transforms] Construct SmallVector with iterator ranges (NFC) Added: Modified: llvm/lib/Transforms/Coroutines/CoroFrame.cpp llvm/lib/Transforms/IPO/GlobalOpt.cpp llvm/lib/Transforms/InstCombine/InstructionCombining.cpp llvm/lib/Transforms/Scalar/LoopFuse.cpp llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp llvm/lib/Transforms/Utils/InlineFunction.cpp Removed: diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp index c67d69a52fd2a..9c3c10660bd0f 100644 --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -1522,7 +1522,7 @@ static void rewritePHIs(BasicBlock ) { // so we need to create an additional "dispatcher" block. if (auto *CleanupPad = dyn_cast_or_null(BB.getFirstNonPHI())) { -SmallVector Preds(pred_begin(), pred_end()); +SmallVector Preds(predecessors()); for (BasicBlock *Pred : Preds) { if (CatchSwitchInst *CS = dyn_cast(Pred->getTerminator())) { @@ -1548,7 +1548,7 @@ static void rewritePHIs(BasicBlock ) { // ehAwareSplitEdge cloned it in the transition blocks. } - SmallVector Preds(pred_begin(), pred_end()); + SmallVector Preds(predecessors()); for (BasicBlock *Pred : Preds) { auto *IncomingBB = ehAwareSplitEdge(Pred, , LandingPad, ReplPHI); IncomingBB->setName(BB.getName() + Twine(".from.") + Pred->getName()); diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 96a27d83bb54c..b0a2194052f30 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -286,7 +286,7 @@ static bool CleanupConstantGlobalUsers( // we delete a constant array, we may also be holding pointer to one of its // elements (or an element of one of its elements if we're dealing with an // array of arrays) in the worklist. - SmallVector WorkList(V->user_begin(), V->user_end()); + SmallVector WorkList(V->users()); while (!WorkList.empty()) { Value *UV = WorkList.pop_back_val(); if (!UV) diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 5d8abe14327bb..f63859fbdde05 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -1816,7 +1816,7 @@ static Instruction *foldSelectGEP(GetElementPtrInst , // gep (select Cond, TrueC, FalseC), IndexC --> select Cond, TrueC', FalseC' // Propagate 'inbounds' and metadata from existing instructions. // Note: using IRBuilder to create the constants for efficiency. - SmallVector IndexC(GEP.idx_begin(), GEP.idx_end()); + SmallVector IndexC(GEP.indices()); bool IsInBounds = GEP.isInBounds(); Value *NewTrueC = IsInBounds ? Builder.CreateInBoundsGEP(TrueC, IndexC) : Builder.CreateGEP(TrueC, IndexC); @@ -1826,7 +1826,7 @@ static Instruction *foldSelectGEP(GetElementPtrInst , } Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst ) { - SmallVector Ops(GEP.op_begin(), GEP.op_end()); + SmallVector Ops(GEP.operands()); Type *GEPType = GEP.getType(); Type *GEPEltType = GEP.getSourceElementType(); bool IsGEPSrcEleScalable = isa(GEPEltType); @@ -2232,7 +2232,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst ) { // -> // %0 = GEP [10 x i8] addrspace(1)* X, ... // addrspacecast i8 addrspace(1)* %0 to i8* -SmallVector Idx(GEP.idx_begin(), GEP.idx_end()); +SmallVector Idx(GEP.indices()); Value *NewGEP = GEP.isInBounds() ? Builder.CreateInBoundsGEP(StrippedPtrEltTy, StrippedPtr, diff --git a/llvm/lib/Transforms/Scalar/LoopFuse.cpp b/llvm/lib/Transforms/Scalar/LoopFuse.cpp index 4d63ed90096cc..b5f8dfa9aafbb 100644 --- a/llvm/lib/Transforms/Scalar/LoopFuse.cpp +++ b/llvm/lib/Transforms/Scalar/LoopFuse.cpp @@ -1474,8 +1474,7 @@ struct LoopFuser { mergeLatch(FC0, FC1); // Merge the loops. -SmallVector Blocks(FC1.L->block_begin(), -FC1.L->block_end()); +SmallVector Blocks(FC1.L->blocks()); for (BasicBlock *BB : Blocks) { FC0.L->addBlockEntry(BB); FC1.L->removeBlockFromLoop(BB); @@ -1765,8 +1764,7 @@ struct LoopFuser { mergeLatch(FC0, FC1); // Merge the loops. -SmallVector Blocks(FC1.L->block_begin(), -
[llvm-branch-commits] [llvm] f7f42e6 - [TableGen] Use llvm::append_range (NFC)
Author: Kazu Hirata Date: 2021-01-02T09:24:13-08:00 New Revision: f7f42e64dfa287479e97fb0ddd3212b953622819 URL: https://github.com/llvm/llvm-project/commit/f7f42e64dfa287479e97fb0ddd3212b953622819 DIFF: https://github.com/llvm/llvm-project/commit/f7f42e64dfa287479e97fb0ddd3212b953622819.diff LOG: [TableGen] Use llvm::append_range (NFC) Added: Modified: llvm/utils/TableGen/CodeGenDAGPatterns.cpp llvm/utils/TableGen/CodeGenSchedule.cpp llvm/utils/TableGen/CodeGenTarget.cpp llvm/utils/TableGen/FixedLenDecoderEmitter.cpp llvm/utils/TableGen/RegisterInfoEmitter.cpp llvm/utils/TableGen/SubtargetEmitter.cpp llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp Removed: diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp index e098f632c80af..6b6e1ec7b04d2 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp @@ -4293,7 +4293,7 @@ void CodeGenDAGPatterns::ExpandHwModeBasedTypes() { std::vector Preds = P.Predicates; const std::vector = ModeChecks[Mode]; -Preds.insert(Preds.end(), MC.begin(), MC.end()); +llvm::append_range(Preds, MC); PatternsToMatch.emplace_back(P.getSrcRecord(), Preds, std::move(NewSrc), std::move(NewDst), P.getDstRegs(), P.getAddedComplexity(), Record::getNewUID(), diff --git a/llvm/utils/TableGen/CodeGenSchedule.cpp b/llvm/utils/TableGen/CodeGenSchedule.cpp index 8b54ff0d1d72b..3210a60d9de26 100644 --- a/llvm/utils/TableGen/CodeGenSchedule.cpp +++ b/llvm/utils/TableGen/CodeGenSchedule.cpp @@ -1549,8 +1549,7 @@ pushVariant(const TransVariant , bool IsRead) { ExpandedRWs.push_back(*RWI); else SchedModels.expandRWSequence(*RWI, ExpandedRWs, IsRead); - RWSequences[OperIdx].insert(RWSequences[OperIdx].end(), - ExpandedRWs.begin(), ExpandedRWs.end()); + llvm::append_range(RWSequences[OperIdx], ExpandedRWs); } assert(OperIdx == RWSequences.size() && "missed a sequence"); } @@ -1566,7 +1565,7 @@ pushVariant(const TransVariant , bool IsRead) { else SchedModels.expandRWSequence(*RWI, ExpandedRWs, IsRead); } -Seq.insert(Seq.end(), ExpandedRWs.begin(), ExpandedRWs.end()); +llvm::append_range(Seq, ExpandedRWs); } } @@ -1826,8 +1825,7 @@ void CodeGenSchedModels::verifyProcResourceGroups(CodeGenProcModel ) { OtherUnits.begin(), OtherUnits.end()) != CheckUnits.end()) { // CheckUnits and OtherUnits overlap -OtherUnits.insert(OtherUnits.end(), CheckUnits.begin(), - CheckUnits.end()); +llvm::append_range(OtherUnits, CheckUnits); if (!hasSuperGroup(OtherUnits, PM)) { PrintFatalError((PM.ProcResourceDefs[i])->getLoc(), "proc resource group overlaps with " diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp index 2cfcd1820cc1d..37bce3afa05a9 100644 --- a/llvm/utils/TableGen/CodeGenTarget.cpp +++ b/llvm/utils/TableGen/CodeGenTarget.cpp @@ -403,7 +403,7 @@ std::vector CodeGenTarget::getRegisterVTs(Record *R) for (const auto : getRegBank().getRegClasses()) { if (RC.contains(Reg)) { ArrayRef InVTs = RC.getValueTypes(); - Result.insert(Result.end(), InVTs.begin(), InVTs.end()); + llvm::append_range(Result, InVTs); } } @@ -416,7 +416,7 @@ std::vector CodeGenTarget::getRegisterVTs(Record *R) void CodeGenTarget::ReadLegalValueTypes() const { for (const auto : getRegBank().getRegClasses()) -LegalValueTypes.insert(LegalValueTypes.end(), RC.VTs.begin(), RC.VTs.end()); +llvm::append_range(LegalValueTypes, RC.VTs); // Remove duplicates. llvm::sort(LegalValueTypes); diff --git a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp index 6a7db45c6bde9..4f1f559f99f0e 100644 --- a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -722,7 +722,7 @@ void Filter::emitTableEntry(DecoderTableInfo ) const { assert(TableInfo.FixupStack.size() > 1 && "fixup stack underflow!"); FixupScopeList::iterator Source = TableInfo.FixupStack.end() - 1; FixupScopeList::iterator Dest = Source - 1; - Dest->insert(Dest->end(), Source->begin(), Source->end()); + llvm::append_range(*Dest, *Source); TableInfo.FixupStack.pop_back(); // If there is no fallthrough, then the final filter should get fixed @@ -2010,9 +2010,8 @@ populateInstruction(CodeGenTarget , const Record , // For each operand, see if we can figure out where it is encoded. for (const auto : InOutOperands) { if (!NumberedInsnOperands[std::string(Op.second)].empty()) { -
[llvm-branch-commits] [llvm] c50f9b2 - [LV] Clean up trailing whitespace (NFC).
Author: Florian Hahn Date: 2021-01-02T16:43:13Z New Revision: c50f9b2351eca8642a5a816abb7062469131eb33 URL: https://github.com/llvm/llvm-project/commit/c50f9b2351eca8642a5a816abb7062469131eb33 DIFF: https://github.com/llvm/llvm-project/commit/c50f9b2351eca8642a5a816abb7062469131eb33.diff LOG: [LV] Clean up trailing whitespace (NFC). Clean up some stray whitespace that sneaked in recently. Added: Modified: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp Removed: diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 472251840463..a55efe1c323a 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -3012,7 +3012,7 @@ Value *InnerLoopVectorizer::getOrCreateVectorTripCount(Loop *L) { // does not evenly divide the trip count, no adjustment is necessary since // there will already be scalar iterations. Note that the minimum iterations // check ensures that N >= Step. The cases are: - // 1) If there is a non-reversed interleaved group that may speculatively + // 1) If there is a non-reversed interleaved group that may speculatively //access memory out-of-bounds. // 2) If any instruction may follow a conditionally taken exit. That is, if //the loop contains multiple exiting blocks, or a single exiting block @@ -5304,11 +5304,11 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) { auto isVectorizedMemAccessUse = [&](Instruction *I, Value *Ptr) -> bool { return getLoadStorePointerOperand(I) == Ptr && isUniformDecision(I, VF); }; - + // Holds a list of values which are known to have at least one uniform use. // Note that there may be other uses which aren't uniform. A "uniform use" // here is something which only demands lane 0 of the unrolled iterations; - // it does not imply that all lanes produce the same value (e.g. this is not + // it does not imply that all lanes produce the same value (e.g. this is not // the usual meaning of uniform) SmallPtrSet HasUniformUse; @@ -5515,7 +5515,7 @@ LoopVectorizationCostModel::computeMaxVF(ElementCount UserVF, unsigned UserIC) { } // Now try the tail folding - + // Invalidate interleave groups that require an epilogue if we can't mask // the interleave-group. if (!useMaskedInterleavedAccesses(TTI)) { @@ -5568,7 +5568,7 @@ LoopVectorizationCostModel::computeMaxVF(ElementCount UserVF, unsigned UserIC) { LLVM_DEBUG(dbgs() << "LV: Can't fold tail by masking: don't vectorize\n"); return None; } - + if (TC == 0) { reportVectorizationFailure( "Unable to calculate the loop count due to complex control flow", @@ -6276,7 +6276,7 @@ LoopVectorizationCostModel::calculateRegisterUsage(ArrayRef VFs) { } } } - + for (auto& pair : RegUsage) { if (MaxUsages[j].find(pair.first) != MaxUsages[j].end()) MaxUsages[j][pair.first] = std::max(MaxUsages[j][pair.first], pair.second); @@ -6294,7 +6294,7 @@ LoopVectorizationCostModel::calculateRegisterUsage(ArrayRef VFs) { for (unsigned i = 0, e = VFs.size(); i < e; ++i) { SmallMapVector Invariant; - + for (auto Inst : LoopInvariants) { unsigned Usage = VFs[i].isScalar() ? 1 : GetRegUsage(Inst->getType(), VFs[i]); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] d8af310 - [LV] Add missed optimization fold-tail test
Author: Gil Rapaport Date: 2021-01-02T14:00:15+02:00 New Revision: d8af31006351c9f441d73d4b6c5ea6d109f3d4f1 URL: https://github.com/llvm/llvm-project/commit/d8af31006351c9f441d73d4b6c5ea6d109f3d4f1 DIFF: https://github.com/llvm/llvm-project/commit/d8af31006351c9f441d73d4b6c5ea6d109f3d4f1.diff LOG: [LV] Add missed optimization fold-tail test The loop vectorizer avoids folding the tail for loop's whose trip-count is known to SCEV to be divisible by VF. In this case the assumption providing this information is not taken into account, so the tail is needlessly folded. Added: llvm/test/Transforms/LoopVectorize/dont-fold-tail-for-assumed-divisible-TC.ll Modified: Removed: diff --git a/llvm/test/Transforms/LoopVectorize/dont-fold-tail-for-assumed-divisible-TC.ll b/llvm/test/Transforms/LoopVectorize/dont-fold-tail-for-assumed-divisible-TC.ll new file mode 100644 index ..e0a14db9a6d1 --- /dev/null +++ b/llvm/test/Transforms/LoopVectorize/dont-fold-tail-for-assumed-divisible-TC.ll @@ -0,0 +1,99 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -loop-vectorize -force-vector-width=4 -S | FileCheck %s + +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" + +; TODO: Make sure the loop is vectorized under -Os without folding its tail based on +; its trip-count's lower bits assumed to be zero. + +define dso_local void @assumeAlignedTC(i32* noalias nocapture %A, i32* %p) optsize { +; CHECK-LABEL: @assumeAlignedTC( +; CHECK-NEXT: entry: +; CHECK-NEXT:[[N:%.*]] = load i32, i32* [[P:%.*]], align 4 +; CHECK-NEXT:[[AND:%.*]] = and i32 [[N]], 3 +; CHECK-NEXT:[[CMP:%.*]] = icmp eq i32 [[AND]], 0 +; CHECK-NEXT:tail call void @llvm.assume(i1 [[CMP]]) +; CHECK-NEXT:br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] +; CHECK: vector.ph: +; CHECK-NEXT:[[N_RND_UP:%.*]] = add i32 [[N]], 3 +; CHECK-NEXT:[[N_MOD_VF:%.*]] = urem i32 [[N_RND_UP]], 4 +; CHECK-NEXT:[[N_VEC:%.*]] = sub i32 [[N_RND_UP]], [[N_MOD_VF]] +; CHECK-NEXT:[[TRIP_COUNT_MINUS_1:%.*]] = sub i32 [[N]], 1 +; CHECK-NEXT:[[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[TRIP_COUNT_MINUS_1]], i32 0 +; CHECK-NEXT:[[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer +; CHECK-NEXT:br label [[VECTOR_BODY:%.*]] +; CHECK: vector.body: +; CHECK-NEXT:[[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[PRED_STORE_CONTINUE6:%.*]] ] +; CHECK-NEXT:[[VEC_IND:%.*]] = phi <4 x i32> [ , [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[PRED_STORE_CONTINUE6]] ] +; CHECK-NEXT:[[TMP0:%.*]] = icmp ule <4 x i32> [[VEC_IND]], [[BROADCAST_SPLAT]] +; CHECK-NEXT:[[TMP1:%.*]] = extractelement <4 x i1> [[TMP0]], i32 0 +; CHECK-NEXT:br i1 [[TMP1]], label [[PRED_STORE_IF:%.*]], label [[PRED_STORE_CONTINUE:%.*]] +; CHECK: pred.store.if: +; CHECK-NEXT:[[TMP2:%.*]] = add i32 [[INDEX]], 0 +; CHECK-NEXT:[[TMP3:%.*]] = getelementptr inbounds i32, i32* [[A:%.*]], i32 [[TMP2]] +; CHECK-NEXT:store i32 13, i32* [[TMP3]], align 1 +; CHECK-NEXT:br label [[PRED_STORE_CONTINUE]] +; CHECK: pred.store.continue: +; CHECK-NEXT:[[TMP4:%.*]] = extractelement <4 x i1> [[TMP0]], i32 1 +; CHECK-NEXT:br i1 [[TMP4]], label [[PRED_STORE_IF1:%.*]], label [[PRED_STORE_CONTINUE2:%.*]] +; CHECK: pred.store.if1: +; CHECK-NEXT:[[TMP5:%.*]] = add i32 [[INDEX]], 1 +; CHECK-NEXT:[[TMP6:%.*]] = getelementptr inbounds i32, i32* [[A]], i32 [[TMP5]] +; CHECK-NEXT:store i32 13, i32* [[TMP6]], align 1 +; CHECK-NEXT:br label [[PRED_STORE_CONTINUE2]] +; CHECK: pred.store.continue2: +; CHECK-NEXT:[[TMP7:%.*]] = extractelement <4 x i1> [[TMP0]], i32 2 +; CHECK-NEXT:br i1 [[TMP7]], label [[PRED_STORE_IF3:%.*]], label [[PRED_STORE_CONTINUE4:%.*]] +; CHECK: pred.store.if3: +; CHECK-NEXT:[[TMP8:%.*]] = add i32 [[INDEX]], 2 +; CHECK-NEXT:[[TMP9:%.*]] = getelementptr inbounds i32, i32* [[A]], i32 [[TMP8]] +; CHECK-NEXT:store i32 13, i32* [[TMP9]], align 1 +; CHECK-NEXT:br label [[PRED_STORE_CONTINUE4]] +; CHECK: pred.store.continue4: +; CHECK-NEXT:[[TMP10:%.*]] = extractelement <4 x i1> [[TMP0]], i32 3 +; CHECK-NEXT:br i1 [[TMP10]], label [[PRED_STORE_IF5:%.*]], label [[PRED_STORE_CONTINUE6]] +; CHECK: pred.store.if5: +; CHECK-NEXT:[[TMP11:%.*]] = add i32 [[INDEX]], 3 +; CHECK-NEXT:[[TMP12:%.*]] = getelementptr inbounds i32, i32* [[A]], i32 [[TMP11]] +; CHECK-NEXT:store i32 13, i32* [[TMP12]], align 1 +; CHECK-NEXT:br label [[PRED_STORE_CONTINUE6]] +; CHECK: pred.store.continue6: +; CHECK-NEXT:[[INDEX_NEXT]] = add i32 [[INDEX]], 4 +; CHECK-NEXT:[[VEC_IND_NEXT]] = add <4 x i32> [[VEC_IND]], +;
[llvm-branch-commits] [llvm] f4ea219 - [NFCI][CodeGen] DwarfEHPrepare: don't actually pass DTU into simplifyCFG by default
Author: Roman Lebedev Date: 2021-01-02T14:38:52+03:00 New Revision: f4ea21947d907c8730fef2be8fbad457f1d96a0e URL: https://github.com/llvm/llvm-project/commit/f4ea21947d907c8730fef2be8fbad457f1d96a0e DIFF: https://github.com/llvm/llvm-project/commit/f4ea21947d907c8730fef2be8fbad457f1d96a0e.diff LOG: [NFCI][CodeGen] DwarfEHPrepare: don't actually pass DTU into simplifyCFG by default also, don't verify DomTree unless we intend to maintain it. This is a very dumb think-o, i guess i was even warned about it by subconsciousness in 4b80647367950ba3da6a08260487fd0dbc50a9c5's commit message.. Fixes a compile-time regression reported by Martin Storsjö in post-commit review of 2461cdb41724298591133c811df82b0064adfa6b. Added: Modified: llvm/lib/CodeGen/DwarfEHPrepare.cpp Removed: diff --git a/llvm/lib/CodeGen/DwarfEHPrepare.cpp b/llvm/lib/CodeGen/DwarfEHPrepare.cpp index 34a04feec040..c1b764214546 100644 --- a/llvm/lib/CodeGen/DwarfEHPrepare.cpp +++ b/llvm/lib/CodeGen/DwarfEHPrepare.cpp @@ -153,7 +153,7 @@ size_t DwarfEHPrepare::pruneUnreachableResumes( BasicBlock *BB = RI->getParent(); new UnreachableInst(Ctx, RI); RI->eraseFromParent(); - simplifyCFG(BB, *TTI, DTU); + simplifyCFG(BB, *TTI, RequireAndPreserveDomTree ? DTU : nullptr); } } Resumes.resize(ResumesLeft); @@ -249,7 +249,7 @@ bool DwarfEHPrepare::InsertUnwindResumeCalls() { } bool DwarfEHPrepare::run() { - assert(((OptLevel == CodeGenOpt::None) || + assert(((OptLevel == CodeGenOpt::None || !RequireAndPreserveDomTree) || (DTU && DTU->getDomTree().verify(DominatorTree::VerificationLevel::Full))) && "Original domtree is invalid?"); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] b9da488 - [SimplifyCFG] Don't actually take DomTreeUpdater unless we intend to maintain DomTree validity
Author: Roman Lebedev Date: 2021-01-02T14:40:55+03:00 New Revision: b9da488ad729a6604439d1b5e456330bab9321bd URL: https://github.com/llvm/llvm-project/commit/b9da488ad729a6604439d1b5e456330bab9321bd DIFF: https://github.com/llvm/llvm-project/commit/b9da488ad729a6604439d1b5e456330bab9321bd.diff LOG: [SimplifyCFG] Don't actually take DomTreeUpdater unless we intend to maintain DomTree validity This guards against unintentional mistakes like the one i just fixed in previous commit. Added: Modified: llvm/lib/Transforms/Utils/SimplifyCFG.cpp Removed: diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index fa12d8b99644..e1f7ef636a89 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -6700,7 +6700,7 @@ bool SimplifyCFGOpt::run(BasicBlock *BB) { bool llvm::simplifyCFG(BasicBlock *BB, const TargetTransformInfo , DomTreeUpdater *DTU, const SimplifyCFGOptions , SmallPtrSetImpl *LoopHeaders) { - return SimplifyCFGOpt(TTI, DTU, BB->getModule()->getDataLayout(), LoopHeaders, -Options) + return SimplifyCFGOpt(TTI, RequireAndPreserveDomTree ? DTU : nullptr, +BB->getModule()->getDataLayout(), LoopHeaders, Options) .run(BB); } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits