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

Devang Patel devang.patel at gmail.com
Tue Oct 13 10:16:17 PDT 2009


2009/10/11 Török Edwin <edwintorok at gmail.com>:
>>> 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.
>

Now, debug info (location info) is attached to an instruction. There
is a way to check this.

  MetadataContext &TheMetadata = ...getContext().getMetadata();
  unsigned MDDbgKind = TheMetadata.getMDKind("dbg");
  if (MDNode *Dbg = TheMetadata.getMD(MDDbgKind, I)) {

Here Dbg is non-null if debug info is attached with instruction I.

-
Devang




More information about the llvm-commits mailing list