[llvm] [InstCombine] Fold @llvm.experimental.get.vector.length when cnt <= max_lanes (PR #169293)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 25 09:51:17 PST 2025
================
@@ -4005,6 +4005,22 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
}
break;
}
+ case Intrinsic::experimental_get_vector_length: {
+ // get.vector.length(Cnt, MaxLanes) --> Cnt when Cnt <= MaxLanes
+ ConstantRange Cnt = computeConstantRangeIncludingKnownBits(
+ II->getArgOperand(0), false, SQ.getWithInstruction(II));
+ ConstantRange MaxLanes = cast<ConstantInt>(II->getArgOperand(1))
+ ->getValue()
+ .zext(Cnt.getBitWidth());
----------------
dtcxzyw wrote:
This doesn't work when Cnt is shorter than i32.
https://github.com/llvm/llvm-project/pull/169293
More information about the llvm-commits
mailing list