[llvm] 53aad7a - [llvm-reduce] Update NoChunks initializer to be in line with AllChunks.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 21 07:50:51 PDT 2022


Author: Florian Hahn
Date: 2022-09-21T15:50:30+01:00
New Revision: 53aad7a69ac0c486edf9fd14e83a2e2919460210

URL: https://github.com/llvm/llvm-project/commit/53aad7a69ac0c486edf9fd14e83a2e2919460210
DIFF: https://github.com/llvm/llvm-project/commit/53aad7a69ac0c486edf9fd14e83a2e2919460210.diff

LOG: [llvm-reduce] Update NoChunks initializer to be in line with AllChunks.

Without this patch, the assertion triggers below on the test case,
because we are using different oracles for the verification.

    Assertion failed: (Targets == NoChunksCounter.count() && "number of chunks changes when reducing"), function runDeltaPass, file Delta.cpp, line 272.

Added: 
    llvm/test/tools/llvm-reduce/remove-bbs-unreachable.ll

Modified: 
    llvm/tools/llvm-reduce/deltas/Delta.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-reduce/remove-bbs-unreachable.ll b/llvm/test/tools/llvm-reduce/remove-bbs-unreachable.ll
new file mode 100644
index 0000000000000..385cf80c11159
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/remove-bbs-unreachable.ll
@@ -0,0 +1,22 @@
+; Check that verification doesn't fail when reducing a function with
+; unreachable blocks.
+;
+; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=basic-blocks --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: cat %t | FileCheck %s
+
+; CHECK-INTERESTINGNESS: test
+
+; CHECK: define void @test() {
+; CHECK-NEXT:   unreachable:
+; CHECK-NEXT:     ret void
+
+define void @test() {
+entry:
+  br label %exit
+
+unreachable:                                        ; No predecessors!
+  br label %exit
+
+exit:
+  ret void
+}

diff  --git a/llvm/tools/llvm-reduce/deltas/Delta.cpp b/llvm/tools/llvm-reduce/deltas/Delta.cpp
index 8d0a4c6aa2d33..e8224caa134f7 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.cpp
+++ b/llvm/tools/llvm-reduce/deltas/Delta.cpp
@@ -263,7 +263,7 @@ void llvm::runDeltaPass(TestRunner &Test,
 
 #ifndef NDEBUG
     // Make sure that the number of chunks does not change as we reduce.
-    std::vector<Chunk> NoChunks;
+    std::vector<Chunk> NoChunks = {{0, INT_MAX}};
     Oracle NoChunksCounter(NoChunks);
     std::unique_ptr<ReducerWorkItem> Clone =
         cloneReducerWorkItem(Test.getProgram(), Test.getTargetMachine());


        


More information about the llvm-commits mailing list