[llvm] [DebugInfo][RemoveDIs] Instrument loop-rotate for DPValues (PR #72997)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 10:19:58 PST 2023


================
@@ -551,7 +606,17 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
       if (L->hasLoopInvariantOperands(Inst) && !Inst->mayReadFromMemory() &&
           !Inst->mayWriteToMemory() && !Inst->isTerminator() &&
           !isa<DbgInfoIntrinsic>(Inst) && !isa<AllocaInst>(Inst)) {
+
+        if (LoopEntryBranch->getParent()->IsNewDbgInfoFormat) {
+          auto DbgValueRange =
+              LoopEntryBranch->cloneDebugInfoFrom(Inst, NextDbgInst);
----------------
OCHyams wrote:

I'm confused - it looks like `NextDbgInst` is only ever `std::nullopt` or `I->getDbgValueRange().begin();`. Looking at the `cloneDebugInfoFrom` implementation in main, wouldn't those inputs cause the same behaviour? What am I missing?

https://github.com/llvm/llvm-project/pull/72997


More information about the llvm-commits mailing list