[llvm-commits] [llvm] r65356 - in /llvm/branches/Apple/Dib:, lib/CodeGen/AsmPrinter/DwarfWriter.cpp, lib/Transforms/Utils/BasicBlockUtils.cpp, lib/Transforms/Utils/SimplifyCFG.cpp, test/Transforms/SimplifyCFG/dbginfo.ll

Sheng Zhou zhousheng at autoesl.com
Tue Feb 24 00:28:11 PST 2009


Hi Patel,

> Author: dpatel
> Date: Mon Feb 23 18:05:16 2009
> New Revision: 65353
>
> URL: http://llvm.org/viewvc/llvm-project?rev=65353&view=rev
> Log:
> While folding unconditional return move DbgRegionEndInst into the predecessor, instead of removing it. This fixes following tests from llvmgcc42 testsuite.
>
> gcc.c-torture/execute/20000605-3.c
> gcc.c-torture/execute/20020619-1.c
> gcc.c-torture/execute/20030920-1.c
> gcc.c-torture/execute/loop-ivopts-1.c
>
>
> Modified:
>     llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
>     llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
>     llvm/trunk/test/Transforms/SimplifyCFG/dbginfo.ll
>   
Attached is a .ll case (before.ll). And with your change, I got
"after.ll" after pass -simplifycfg which folded unconditional return and
moved DbgRegionEndInst into pred. The question is in after.ll now there
are two "ret" instructions in two basic blocks:

...
bb3.bb5.loopexit_crit_edge: ; preds = %bb2
%tmp = add i32 %x, -1 ; <i32> [#uses=2]
%tmp4 = add i32 %x, %y ; <i32> [#uses=1]
%tmp5 = mul i32 %tmp, %tmp4 ; <i32> [#uses=1]
%tmp6 = add i32 %tmp5, %x ; <i32> [#uses=1]
%tmp7 = add i32 %x, -2 ; <i32> [#uses=1]
%tmp. = zext i32 %tmp7 to i33 ; <i33> [#uses=1]
%tmp.8 = zext i32 %tmp to i33 ; <i33> [#uses=1]
%tmp9 = mul i33 %tmp., %tmp.8 ; <i33> [#uses=1]
%tmp10 = lshr i33 %tmp9, 1 ; <i33> [#uses=1]
%tmp.11 = trunc i33 %tmp10 to i32 ; <i32> [#uses=1]
%tmp12 = mul i32 %tmp.11, %y ; <i32> [#uses=1]
%tmp13 = add i32 %tmp6, %tmp12 ; <i32> [#uses=1]
tail call void @llvm.dbg.region.end({ }* bitcast
(%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
ret i32 %tmp13

bb5: ; preds = %entry
tail call void @llvm.dbg.stoppoint(i32 10, i32 0, { }* bitcast
(%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
ret i32 0

You move the DbgRegionEndInst from bb5 into its pred.
bb3.bb5.loopexit_crit_edge. Is this OK?
I think for this case, the DbgRegionEndInst should be kept in bb5.



Sheng.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: after.ll
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090224/e1e9b8dd/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: before.ll
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090224/e1e9b8dd/attachment-0001.ksh>


More information about the llvm-commits mailing list