[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 18:17:45 PST 2009


Devang Patel ??:
>
> On Feb 24, 2009, at 12:28 AM, Sheng Zhou wrote:
>
>> Hi Patel,
>>
>>> Author: dpatel
>>> Date: Mon Feb 23 18:05:16 2009
>>> New Revision: 65353
>>>
>> 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:
>
> I do not understand. As far as I can tell, this patch has no impact on 
> your test case.
I updated and rebuilt my llvm. And run the following command:

llvm-as < before.ll | opt -simplifycfg -debug | llvm-dis > after.ll

For my case, the pass simplifycfg will fold unconditional return and 
move the DbgRegionEndInst into predecessor basic block, right?
But in this case the original "return" Basic Block doesnt been removed, 
it still return a constant zero:

...
*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*

My question is as the "**llvm.dbg.region.end**" here is to pair off with 
"llvm.dbg.function.start", and indicating the end of  the function,
is it correct to move it to the previous basic block for this case?  As 
we have two "return" basic block, may be each basic block should have 
one "**llvm.dbg.region.end**", but there is just one 
"llvm.dbg.function.start" for paring. I don't know.


Sheng.
> -
> Devang

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090225/26466730/attachment.html>


More information about the llvm-commits mailing list