[PATCH] D95463: Avoid redundant or out-of-order debug value sinking in InstCombine

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 26 19:11:53 PST 2021


rnk added a comment.

Nice find!



================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:3572-3574
+    // We only care about sorting DbgUsers in the same BB, cross-block ordering
+    // does not matter here.
+    return A->getParent() > B->getParent();
----------------
If we already know SrcBlock before we do this sort, I think it would be clearer to the reader if you start out by filtering out all the users not in SrcBlock. Then this comment about other blocks is unnecessary.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:3597
     // here).
     if (User->getParent() != SrcBlock || updateDbgDeclare(User))
       continue;
----------------
This comparison here makes it so that the non-deterministic ordering of users doesn't cause non-deterministic output.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95463/new/

https://reviews.llvm.org/D95463



More information about the llvm-commits mailing list