[PATCH] D41466: [Unroll][DebugInfo] Propagate loop body's debug info to epilog preheader

Z. Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 21 17:34:49 PST 2017


zzheng added inline comments.


================
Comment at: lib/Transforms/Utils/LoopUnrollRuntime.cpp:651-652
                                      DT, LI, PreserveLCSSA);
+    auto *TI = NewExit->getTerminator();
+    TI->setDebugLoc(Header->getTerminator()->getDebugLoc());
     // Split NewExit to insert epilog remainder loop.
----------------
evstupac wrote:
> Am I right that this will set more DebugLoc for epilog case  than for prolog? If so, why?
> If "TI" is supposed to be used only once I wouldn't create it at all:
>   NewExit->getTerminator()->setDebugLoc(
>       Header->getTerminator()->getDebugLoc());
> If not - reuse it in the line 654 and give wider name (like NewExitTerminator).
>  EpilogPreHeader = SplitBlock(NewExit, NewExitTerminator, DT, LI);
> 
NewExit gets its DebugLoc from LatchExit. This DebugLoc is not part of the original loop, it's after the original loop (say loc A).

The conditional branch deciding if epilog will be added to NewExit, which should be part of the original loop in lexical sense.

If a later pass search for debuginfo in RPOT order, it will first find loc A at the conditional branch rather than the merge point of unrolled and epilog loop.

On the other hand, PrologPreHeader gets its debug info from original PreHeader. 


Repository:
  rL LLVM

https://reviews.llvm.org/D41466





More information about the llvm-commits mailing list