[PATCH] D92132: [LV] Support widened induction variables in epilogue vectorization.
Venkataramanan Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 8 00:35:17 PDT 2021
venkataramanan.kumar.llvm added a comment.
Hi Florian,
--Snip--
void foo(double * restrict a, double * restrict b, int N) {
int k=0;
for(int i = 0 , k =2; i < N; ++i, ++k)
a[i] = sin(i)+k;
}
--Snip--
I am able to see the resume value for induction "i" updated properly now after the patch .
--Snip--
33: ; preds = %8, %28
%34 = phi i64 [ %11, %28 ], [ 0, %8 ]
%35 = and i64 %6, 4294967294
%36 = trunc i64 %35 to i32
%37 = add i32 %36, 2
%38 = insertelement <2 x i64> poison, i64 %34, i32 0
%39 = shufflevector <2 x i64> %38, <2 x i64> poison, <2 x i32> zeroinitializer
%40 = or <2 x i64> %39, <i64 0, i64 1>
%41 = trunc i64 %34 to i32
%42 = insertelement <2 x i32> poison, i32 %41, i32 0
%43 = shufflevector <2 x i32> %42, <2 x i32> poison, <2 x i32> zeroinitializer
%44 = or <2 x i32> %43, <i32 0, i32 1>
br label %45
45: ; preds = %45, %33
%46 = phi i64 [ %34, %33 ], [ %55, %45 ]
%47 = phi <2 x i64> [ %40, %33 ], [ %56, %45 ] <== updated
%48 = phi <2 x i32> [ %44, %33 ], [ %57, %45 ] <== updated
--Snip--
I was thinking if we could reuse the incremented widened induction results from the main vector loop. But this seems cleaner and simpler code .
Note the second induction variable k is not updated properly as already pointed out by bmahjour.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92132/new/
https://reviews.llvm.org/D92132
More information about the llvm-commits
mailing list