[PATCH] D156318: Local: fix debug output of replaceDominatedUsesWith()

Ramkumar Ramachandra via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 26 05:08:29 PDT 2023


artagnon created this revision.
artagnon added reviewers: lebedev.ri, nikic, RKSimon.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
artagnon requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The debug output of replaceDominatedUsesWith() prints incorrect
information, and the user is left confused about what exactly was
replaced. Fix this.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156318

Files:
  llvm/lib/Transforms/Utils/Local.cpp


Index: llvm/lib/Transforms/Utils/Local.cpp
===================================================================
--- llvm/lib/Transforms/Utils/Local.cpp
+++ llvm/lib/Transforms/Utils/Local.cpp
@@ -2896,9 +2896,9 @@
   for (Use &U : llvm::make_early_inc_range(From->uses())) {
     if (!Dominates(Root, U))
       continue;
-    U.set(To);
     LLVM_DEBUG(dbgs() << "Replace dominated use of '" << From->getName()
-                      << "' as " << *To << " in " << *U << "\n");
+                      << "' as " << *To << " in " << *U.getUser() << "\n");
+    U.set(To);
     ++Count;
   }
   return Count;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156318.544316.patch
Type: text/x-patch
Size: 607 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230726/a9dd2a4a/attachment.bin>


More information about the llvm-commits mailing list