[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 16:35:25 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);
----------------
nickdesaulniers wrote:
> nickdesaulniers wrote:
> > 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);
> > ```
> errr, more like:
> ```
> diff --git a/llvm/lib/CodeGen/CallBrPrepare.cpp b/llvm/lib/CodeGen/CallBrPrepare.cpp
> index bbf14c5f8e97..c9542de943a2 100644
> --- a/llvm/lib/CodeGen/CallBrPrepare.cpp
> +++ b/llvm/lib/CodeGen/CallBrPrepare.cpp
> @@ -190,8 +190,9 @@ void CallBrPrepare::UpdateSSA(DominatorTree *DT) const {
>          continue;
>        }
>  
> -      // If the Use is dominated by the default dest, do not touch it.
> -      if (DT->dominates(DefaultDest, U))
> +      // If the Use is in the default dest BasicBlock, or dominated by the
> +      // default dest, do not touch it.
> +      if (IsInSameBasicBlock(U, DefaultDest) || DT->dominates(DefaultDest, U))
>          continue;
>  
>        SSAUpdate.Initialize(U->getType(), U->getName());
> ```
bah, neither of those are right. Ok, WIP.


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