Hi Jakob,<div><br></div><div>Thanks for the reply!<br><br><div class="gmail_quote">On Sat, Feb 13, 2010 at 7:02 PM, Jakob Stoklund Olesen <span dir="ltr"><<a href="mailto:stoklund@2pi.dk">stoklund@2pi.dk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><br>
On Feb 13, 2010, at 8:19 AM, nicolas geoffray wrote:<br>
<br>
> Is this a bug with respect to accurate line number information with optimizations?<br>
<br>
</div>No. The way LLVM is designed, debug information is not allowed to interfere with code generation. In fact, if including debug information does change the generated code in any way, it is considered a bug.<br></blockquote>
<div><br></div><div>OK.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
> If not, is there a way to disable this optimization?<br>
<br>
</div>Yes.<br></blockquote><div><br></div><div>Great! :)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
> I browsed the source code to find out where this optimization occurs during code generation, but couldn't find anything. Can someone point me where this optimization is performed?<br>
<br>
</div>The transformation you describe is called tail merging or branch folding. The opposite transformation also occurs. It is called tail duplication.<br>
<br>
Try -disable-branch-fold and perhaps -disable-tail-duplicate.<br>
<br>
Note that debug information on optimized code is a best effort thing. If you depend on certain information to be present, you will almost certainly run into more problems like this.<br>
<font color="#888888"><br></font></blockquote><div><br></div><div>So what I currently depend on, is that each call instruction must have an accurate line number information. I don't care about the line number of other instructions. Will I still run into trouble? If the debug info is attached to the call, how can LLVM optimizers (codegen or IR) mess with it (except with that special branch folding optimization you just mentioned)?</div>
<div><br></div><div>Thanks!</div><div>Nicolas</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><font color="#888888">
/jakob<br>
<br>
</font></blockquote></div><br></div>