[llvm] [LV] Cost EVL width-adjusting zext/trunc as free (PR #225016)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 01:40:38 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.
----------------
fhahn wrote:
Is anything special about those cast or are all such integer casts free? E.g. on AArch64 scalar zext from i32 to i64 are always free IIRC
https://github.com/llvm/llvm-project/pull/225016
More information about the llvm-commits
mailing list