[llvm] [InstCombine] Optimistically allow multiple shufflevector uses in foldOpPhi (PR #114278)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 6 23:41:16 PST 2024
================
@@ -1773,17 +1773,33 @@ Instruction *InstCombinerImpl::foldOpIntoPhi(Instruction &I, PHINode *PN) {
if (NumPHIValues == 0)
return nullptr;
- // We normally only transform phis with a single use. However, if a PHI has
- // multiple uses and they are all the same operation, we can fold *all* of the
- // uses into the PHI.
+ // We normally only transform phis with a single use.
+ bool AllUsesIdentical = false;
+ bool MultipleUses = false;
if (!PN->hasOneUse()) {
- // Walk the use list for the instruction, comparing them to I.
+ // Exceptions:
+ // - All uses are identical.
+ // - All uses are shufflevector instructions that fully simplify; this
+ // helps interleave -> phi -> 2x de-interleave+de patterns.
+ if (isa<ShuffleVectorInst>(I)) {
+ MultipleUses = true;
+ }
----------------
dtcxzyw wrote:
```suggestion
MultipleUses = isa<ShuffleVectorInst>(I);
```
https://github.com/llvm/llvm-project/pull/114278
More information about the llvm-commits
mailing list