[llvm] [VectorCombine] Preserves the maximal legal FPMathFlags during foldShuffleToIdentity (PR #94295)
Henry Jiang via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 4 07:08:40 PDT 2024
================
@@ -1736,23 +1739,64 @@ static Value *generateNewInstTree(ArrayRef<InstLane> Item, FixedVectorType *Ty,
Ops[Idx] = generateNewInstTree(generateInstLaneVectorFromOperand(Item, Idx),
Ty, IdentityLeafs, SplatLeafs, Builder);
}
+
+ FastMathFlags FMF;
+ FMF.setFast();
+ for_each(Item, [&FMF, Lane = FrontLane](const InstLane &E) {
+ if (E.second != Lane)
+ return;
+ auto *I = cast<Instruction>(E.first);
+ if (isa<FPMathOperator>(I))
----------------
mustartt wrote:
I added `E.second != Lane` as `Item` contains the instructions for all lanes, so we can skip the ones that we have already seen before. Removing it would have the same effect, since we are still taking the logical and of all flags.
https://github.com/llvm/llvm-project/pull/94295
More information about the llvm-commits
mailing list