[PATCH] D115432: [LV][ARM] Improve reduction costmodel for mismatching extension types.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 10 02:17:25 PST 2021


sdesmalen added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7111
+                                     TTI::CastContextHint::None, CostKind, Op0);
+      if (Op1Ty != LargestOpTy)
+        RedExtCost1 = TTI.getCastInstrCost(Op1->getOpcode(), ExtType,
----------------
>From what I can see, these two are mutually exclusive, i.e. `(Op0Ty != LargestOpTy && Op1Ty != LargestOpTy) <=> false`. Can you rewrite this as:

  Value *ExtraExtOp = (Op0Ty != LargestOpTy) ? Op0 : Op1;
  InstructionCost ExtraExtCost =
      TTI.getCastInstrCost(ExtraExtOp->getOpcode(), ExtType,
                           VectorType::get(ExtraExtOp->getType(), VectorTy),
                           TTI::CastContextHint::None, CostKind, ExtraExtOp);


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

https://reviews.llvm.org/D115432



More information about the llvm-commits mailing list