[llvm] VectorCombine: lift one-use limitation in foldExtractedCmps (PR #110902)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 03:54:51 PDT 2024


================
@@ -1096,6 +1095,7 @@ bool VectorCombine::foldExtractedCmps(Instruction &I) {
                                 ShufMask);
   NewCost += TTI.getArithmeticInstrCost(I.getOpcode(), CmpTy);
   NewCost += TTI.getVectorInstrCost(*Ext0, CmpTy, CostKind, CheapIndex);
+  NewCost += !Ext0->hasOneUse() * Ext0Cost + !Ext1->hasOneUse() * Ext1Cost;
----------------
RKSimon wrote:

```
NewCost += Ext0->hasOneUse() ? 0 : Ext0Cost;
NewCost += Ext1->hasOneUse() ? 0 : Ext1Cost;

```

https://github.com/llvm/llvm-project/pull/110902


More information about the llvm-commits mailing list