[PATCH] D132704: [LCSSA] Re-use suitable PHI if available instead creating new ones.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 11:19:40 PDT 2022


efriedma added inline comments.
Herald added a subscriber: pcwang-thead.


================
Comment at: llvm/lib/Transforms/Utils/LCSSA.cpp:176
+        }
+      }
       Builder.SetInsertPoint(&ExitBB->front());
----------------
fhahn wrote:
> efriedma wrote:
> > Is the new code to prevent creating identical PHI nodes part of the fix, or just an optimization?  It isn't obviously related.
> Preventing identical phis is the main part of the fix.  The issue is that currently scev expansion can create different LCSSA phis when expanding the same expression (since we changed scev to look through trivial phis)
> 
> If those are then used as incoming values for phis with multiple matching predecessors we create invalid ir .
I'm sorry, I really don't follow how having multiple PHI nodes that use the value messes up the algorithm.  (If someone else does, feel free to take over reviewing...)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132704



More information about the llvm-commits mailing list