[PATCH] D27471: [BDCE/DebugInfo] Preserve llvm.dbg.value's argument

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 6 13:08:15 PST 2016


efriedma added inline comments.


================
Comment at: lib/Transforms/Scalar/BDCE.cpp:44
+    // BDCE should skip it.
+    if (I.mayHaveSideEffects() && !I.hasNUsesOrMore(1))
+      continue;
----------------
"I.use_empty()" is a bit more straightforward than "!I.hasNUsesOrMore(1)".


================
Comment at: lib/Transforms/Scalar/BDCE.cpp:45
+    if (I.mayHaveSideEffects() && !I.hasNUsesOrMore(1))
+      continue;
+
----------------
davide wrote:
> aprantl wrote:
> > It looks like this alters the behavior of the optimization beyond debug info. It would be great if someone else could sign off on this change.
> I discussed this with David M. and he was OK with this solution. I'm still a little nervous this may break optimizations, so I'll be more confident to get this in if Hal signs it off.
I don't think this alters visible behavior without debug info: if the instruction has no uses, RAUW is a no-op, and if mayHaveSideEffects() is true, isInstructionDead() is false.  So this looks fine, I think.


https://reviews.llvm.org/D27471





More information about the llvm-commits mailing list