[LLVMdev] Line number and merged calls
Jakob Stoklund Olesen
stoklund at 2pi.dk
Sat Feb 13 10:02:30 PST 2010
On Feb 13, 2010, at 8:19 AM, nicolas geoffray wrote:
> Is this a bug with respect to accurate line number information with optimizations?
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.
> If not, is there a way to disable this optimization?
> 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?
The transformation you describe is called tail merging or branch folding. The opposite transformation also occurs. It is called tail duplication.
Try -disable-branch-fold and perhaps -disable-tail-duplicate.
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.
More information about the llvm-dev