We don't have a dominator tree in this pass, so we
can't bail out sooner by checking for unreachable
code, but this is a minimal fix for the example in
issue #56875.
return false;
BasicBlock *FirstEntryBlock = CInst1->getParent();
+ // Don't die trying to process degenerate/unreachable code.
+ if (FirstEntryBlock == SecondEntryBlock)
+ return false;
// Either then-path or else-path should be empty.
bool InvertCond2 = false;
exit:
ret void
}
+
+; This would crash.
+
+declare i1 @llvm.smax.i1(i1, i1) #0
+
+; CHECK-LABEL: @PR56875
+define void @PR56875(i1 %val_i1_5) {
+entry_1:
+ ret void
+
+bb_2: ; preds = %bb_4
+ br label %bb_4
+
+bb_4: ; preds = %bb_4, %bb_2
+ %val_i1_46 = call i1 @llvm.smax.i1(i1 %val_i1_5, i1 %val_i1_5)
+ br i1 %val_i1_46, label %bb_4, label %bb_2
+}