<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Devang Patel 写道:
<blockquote cite="mid:755AB232-2660-4EAB-BC39-29511FF724D0@apple.com"
 type="cite"><br>
On Feb 24, 2009, at 12:28 AM, Sheng Zhou wrote:
  <br>
  <br>
  <blockquote type="cite">Hi Patel,
    <br>
    <br>
    <blockquote type="cite">Author: dpatel
      <br>
Date: Mon Feb 23 18:05:16 2009
      <br>
New Revision: 65353
      <br>
      <br>
    </blockquote>
Attached is a .ll case (before.ll). And with your change, I got
    <br>
"after.ll" after pass -simplifycfg which folded unconditional return
and
    <br>
moved DbgRegionEndInst into pred. The question is in after.ll now there
    <br>
are two "ret" instructions in two basic blocks:
    <br>
  </blockquote>
  <br>
I do not understand. As far as I can tell, this patch has no impact on
your test case.
  <br>
</blockquote>
I updated and rebuilt my llvm. And run the following command:<br>
<br>
llvm-as < before.ll | opt -simplifycfg -debug | llvm-dis >
after.ll<br>
<br>
For my case, the pass simplifycfg will fold unconditional return and
move the DbgRegionEndInst into predecessor basic block, right?<br>
But in this case the original "return" Basic Block doesnt been removed,
it still return a constant zero:<br>
<br>
<pre wrap="">...
<b>bb3.bb5.loopexit_crit_edge: ; preds = %bb2</b>
%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]
<b>tail call void @llvm.dbg.region.end({ }* bitcast
(%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))</b>
<b>ret i32 %tmp13</b>

<b>bb5: ; preds = %entry</b>
tail call void @llvm.dbg.stoppoint(i32 10, i32 0, { }* bitcast
(%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
<b>ret i32 0</b></pre>
My question is as the "<b><b>llvm.dbg.region.end</b></b>" here is to
pair off with "llvm.dbg.function.start", and indicating the end of  the
function, <br>
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 "<b><b>llvm.dbg.region.end</b></b>", but there is just one
"llvm.dbg.function.start" for paring. I don't know.<br>
<br>
<br>
Sheng.<br>
<blockquote cite="mid:755AB232-2660-4EAB-BC39-29511FF724D0@apple.com"
 type="cite">-
  <br>
Devang
  <br>
</blockquote>
<br>
</body>
</html>