[llvm] [VPlan] Hoist loads with invariant addresses using noalias metadata. (PR #166247)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 4 06:07:12 PST 2025
================
@@ -156,15 +156,15 @@ define void @trunc_store(ptr %dst, ptr %src, i16 %x) #1 {
; DEFAULT-NEXT: [[VEC_EPILOG_RESUME_VAL:%.*]] = phi i64 [ 992, [[VEC_EPILOG_ITER_CHECK]] ], [ 0, [[VECTOR_MAIN_LOOP_ITER_CHECK]] ]
; DEFAULT-NEXT: [[BROADCAST_SPLATINSERT4:%.*]] = insertelement <8 x i16> poison, i16 [[X]], i64 0
; DEFAULT-NEXT: [[BROADCAST_SPLAT5:%.*]] = shufflevector <8 x i16> [[BROADCAST_SPLATINSERT4]], <8 x i16> poison, <8 x i32> zeroinitializer
-; DEFAULT-NEXT: [[TMP7:%.*]] = trunc <8 x i16> [[BROADCAST_SPLAT5]] to <8 x i8>
-; DEFAULT-NEXT: br label [[VEC_EPILOG_VECTOR_BODY:%.*]]
-; DEFAULT: vec.epilog.vector.body:
----------------
david-arm wrote:
Hmm, I must be missing something because I don't see any metadata on the original scalar loop:
```
entry:
br label %loop
loop:
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
%x.ext = zext i16 %x to i64
%l = load i64, ptr %src, align 8
%and = and i64 %l, %x.ext
%trunc = trunc i64 %and to i8
%gep = getelementptr i8, ptr %dst, i64 %iv
store i8 %trunc, ptr %gep, align 1
%iv.next = add i64 %iv, 1
%ec = icmp eq i64 %iv.next, 1000
br i1 %ec, label %exit, label %loop
exit:
ret void
```
and the function pointer arguments do not have `noalias` attached either.
Is it the loop vectoriser itself that is first adding the metadata, then using it to perform the transformation?
https://github.com/llvm/llvm-project/pull/166247
More information about the llvm-commits
mailing list