[llvm-commits] [PATCH] Preserve DebugInfo during LICM

Török Edwin edwintorok at gmail.com
Sun Oct 11 12:19:27 PDT 2009

On 2009-10-11 21:58, Chris Lattner wrote:
> On Oct 8, 2009, at 2:23 AM, Török Edwin wrote:
>> Hi,
> Hi Edwin, sorry for the delay, I was hoping Devang would look at this.

Thanks for the review.

>> LICM currently sinks, and deletes debug stoppoints as dead instructions.
> That is bad :).
>> The attached patch disables sink/hoist of debuginfo (simplifycfg should
>> already knows to ignore debuginfo when checking if it can merge blocks),
>> and also updates the debug info when sinking/hoisting instructions (by
>> copying the stoppoints as needed).
> Your change to not hoist debug intrinsics makes a lot of sense, please
> commit. I don't think the UpdateDbgInfoForMotion part is needed
> though.  Devang is moving line # info to be metadata on instructions,
> which will obsolete it.

Ok, I committed the nohoist/nodelete part.

>> I think that we'd need another TEST.dbgquality that tests whether each
>> basicblock has at least one stoppoint (if original did),
>> and also outputs how many instructions have a stoppoint in same BB, how
>> many have a stoppoint
>> foundable by findStopPointInst, and how many don't have at all. The test
>> would pass if each BB has at least one stoppoint,
> I'm not sure what the right approach is here.  When stoppoints move to
> being on the instructions, we won't really need this.

We'd need something else:  check that each insn has a debug info, some
optimizers may create new instructions and forget
to set debug info.

But you're right, there is no point working on this now, since the debug
info is about to undergo a major change.

> However, there will be other forms of "poor debug info", for example,
> when we implemented this:
> http://nondot.org/sabre/LLVMNotes/DebugInfoVariableInfo.txt
> optimizers will stomp on values used by @llvm.dbg.value, silently
> pessimizing the debug info.  It would be nice to have a way to find
> the "bad" cases of these and fix them.

We'd need something like IsOnlyUsedByDebugInfoIntrinsic() for dbg.values.

Best regards,

More information about the llvm-commits mailing list