Befor Add FPM:
define void @main() {
entry:
%t = alloca i32, align 4
store i32 1, i32* %t, align 4
br label %loop
loop: ; preds = %loopBody, %entry
%t2 = load i32, i32* %t, align 4
%0 = and i32 %t2, 1
%1 = icmp eq i32 %0, 0
br i1 %1, label %afterLoop, label %loopBody
loopBody: ; preds = %loop
br label %afterLoop
br label %loop
afterLoop: ; preds = %loop, %loopBody
%t3 = load i32, i32* %t, align 4
%calltmp = call void @test(i32 %t3)
ret void
}
declare void @test(i32)
After add createCFGSimplification By call FPM->add(llvm::createCFGSimplificationPass())
It turns to
define void @main() {
entry:
br label %loop
loop: ; preds = %loop, %entry
br void
with a Segmentation fault