[LLVMdev] Remove identical or redundant basic blocks?
Heinz Riener
hriener at student.tugraz.at
Sat May 8 08:48:36 PDT 2010
Dear all,
after optimizing a small LLVM example program (i.e., with opt -O3), the
resulting code contains several basic blocks, which I consider identical
or redundant. For instance,
return: ; preds = %min.exit
ret i32 0
bb15: ; preds = %min.exit
ret i32 0
or,
bb7.i: ; preds = %bb1.i
br label %bb3.i
bb9.i: ; preds = %bb1.i
br label %bb3.i
I think it is safe to remove the blocks bb7.i, bb9.i, bb15 while
replacing each jump to bb15 with return and jumps to bb7.i, bb9.i with
bb3.i.
Is there any opt pass I can apply to the code to merge or remove these
blocks?
Heinz
More information about the llvm-dev
mailing list