[PATCH] D42566: [InstCombine] Preserve debug values for eliminable casts

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 14:00:16 PST 2018


aprantl accepted this revision.
aprantl added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:280
+              Res, DII->getVariable(), DII->getExpression(),
+              DII->getDebugLoc().get(), &*std::next(CI.getIterator()));
+      }
----------------
vsk wrote:
> aprantl wrote:
> > The insertion point should be directly before or after DII. The position of the dbg.value intrinsic is significant as it determines when the variable will be visible in the debugger.
> I don't think the insertion point can be directly before or after DII.
> 
> Take a look at the change to the "alloca-cast-debuginfo.ll" test below: inserting a dbg.value directly before/after DII would introduce a use of [[simplified]] before it's def.
> 
> The current code puts the fresh dbg.value in the exact spot where the dying cast is. Doesn't that reflect when the variable is visible precisely?
I see. If CI guaranteed to be immediately after the old cast, this is indeed correct. Thanks for clarifying.


https://reviews.llvm.org/D42566





More information about the llvm-commits mailing list