[llvm] [VPlan] Strip dead code in (Call|Intrinsic)::execute (NFC) (PR #203092)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 14 12:31:32 PDT 2026
================
@@ -2042,20 +2042,9 @@ void VPWidenCallRecipe::execute(VPTransformState &State) {
assert(State.VF.isVector() && "not widening");
assert(Variant != nullptr && "Can't create vector function.");
- FunctionType *VFTy = Variant->getFunctionType();
- // Add return type if intrinsic is overloaded on it.
SmallVector<Value *, 4> Args;
- for (const auto &I : enumerate(args())) {
- Value *Arg;
- // Some vectorized function variants may also take a scalar argument,
- // e.g. linear parameters for pointers. This needs to be the scalar value
- // from the start of the respective part when interleaving.
- if (!VFTy->getParamType(I.index())->isVectorTy())
- Arg = State.get(I.value(), VPLane(0));
- else
- Arg = State.get(I.value(), usesFirstLaneOnly(I.value()));
- Args.push_back(Arg);
- }
+ for (VPValue *Op : args())
+ Args.push_back(State.get(Op, usesFirstLaneOnly(Op)));
----------------
fhahn wrote:
I think this may not be NFC, if `Op` is used in different positions, once as scalar and as vector otherwise.
Something like
```
; bin/opt -passes=loop-vectorize -force-vector-width=2 -force-vector-interleave=1
define void @test(ptr noalias %p, i64 %n) {
entry:
br label %loop
loop:
%iv = phi i64 [0, %entry], [%iv.next, %loop]
%gep = getelementptr i64, ptr %p, i64 %iv
%r = call i64 @foo(i64 %iv, i64 %iv) #0
store i64 %r, ptr %gep, align 8
%iv.next = add i64 %iv, 1
%ec = icmp eq i64 %iv.next, %n
br i1 %ec, label %exit, label %loop
exit:
ret void
}
declare i64 @foo(i64, i64)
declare <2 x i64> @vec_foo(<2 x i64>, i64)
attributes #0 = { nounwind "vector-function-abi-variant"="_ZGVnN2vl1_foo(vec_foo)" }
```
https://github.com/llvm/llvm-project/pull/203092
More information about the llvm-commits
mailing list