[PATCH] D139970: [llvm][CallBrPrepare] use SSAUpdater to use intrinsic value

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 14:52:55 PST 2022


nickdesaulniers added inline comments.


================
Comment at: llvm/lib/CodeGen/CallBrPrepare.cpp:180
+
+    for (Use &U : CBR->uses()) {
+      PrintDebugDomInfo(DT, U, LandingPad, /*IsDefaultDest*/ false);
----------------
This will loop infinitely if we update a `Use` in flight;

```
diff --git a/llvm/lib/CodeGen/CallBrPrepare.cpp b/llvm/lib/CodeGen/CallBrPrepare.cpp
index bbf14c5f8e97..7e9ad9593f45 100644
--- a/llvm/lib/CodeGen/CallBrPrepare.cpp
+++ b/llvm/lib/CodeGen/CallBrPrepare.cpp
@@ -176,8 +176,11 @@ void CallBrPrepare::UpdateSSA(DominatorTree *DT) const {
     CallBrInst *CBR = Pair.second;
     BasicBlock *DefaultDest = CBR->getDefaultDest();
     BasicBlock *LandingPad = Intrinsic->getParent();
+    SmallPtrSet<Use *, 2> Visited;
 
     for (Use &U : CBR->uses()) {
+      if (Visited.insert(&U).second)
+        continue;
       PrintDebugDomInfo(DT, U, LandingPad, /*IsDefaultDest*/ false);
       PrintDebugDomInfo(DT, U, DefaultDest, /*IsDefaultDest*/ true);
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139970



More information about the llvm-commits mailing list