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.
--- /dev/null
+; 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
+}
#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());