[llvm] [LV] Cost EVL width-adjusting zext/trunc as free (PR #225016)
Pengcheng Wang via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 01:59:28 PDT 2026
================
@@ -1360,9 +1360,17 @@ InstructionCost VPInstruction::computeCost(ElementCount VF,
// NOTE: At the moment it seems only possible to expose this path for
// the trunc, zext and sext opcodes.
// TODO: Update VF arg to use onlyFirstLaneUsed once WidenCast is unified.
- if (Instruction::isCast(getOpcode()))
+ if (Instruction::isCast(getOpcode())) {
+ // A scalar zext/trunc that only adjusts the width of an
+ // ExplicitVectorLength to the canonical IV type is free: it feeds only
+ // the IV increment and AVL decrement, which are modeled as free below.
----------------
wangpc-pp wrote:
Normally all these casts in LV can be free, I cannot imagine one that is not.
https://github.com/llvm/llvm-project/pull/225016
More information about the llvm-commits
mailing list