[PATCH] D146958: [SCEV] Do not plant SCEV checks unnecessarily
Paul Osmialowski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 4 12:11:59 PDT 2023
pawosm01 updated this revision to Diff 510884.
pawosm01 added a comment.
following reviewer's advice.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146958/new/
https://reviews.llvm.org/D146958
Files:
llvm/lib/Analysis/LoopAccessAnalysis.cpp
llvm/lib/Analysis/VectorUtils.cpp
llvm/test/Transforms/LoopVectorize/vector-no-scevcheck.ll
Index: llvm/test/Transforms/LoopVectorize/vector-no-scevcheck.ll
===================================================================
--- llvm/test/Transforms/LoopVectorize/vector-no-scevcheck.ll
+++ llvm/test/Transforms/LoopVectorize/vector-no-scevcheck.ll
@@ -2,8 +2,7 @@
define void @foo(ptr %pout, ptr %pin, i64 %val0, i64 %val1, i64 %val2) {
; CHECK-LABEL: @foo(
-; FIXME: CHECK below needs to be changed to CHECK-NOT to confirm the change.
-; CHECK: vector.scevcheck
+; CHECK-NOT: vector.scevcheck
; CHECK: vector.body
entry:
%0 = getelementptr double, ptr %pin, i64 %val0
Index: llvm/lib/Analysis/VectorUtils.cpp
===================================================================
--- llvm/lib/Analysis/VectorUtils.cpp
+++ llvm/lib/Analysis/VectorUtils.cpp
@@ -1157,6 +1157,12 @@
Value *Ptr = getLoadStorePointerOperand(&I);
if (!Ptr)
continue;
+
+ // If the pointer is invariant then there is no stride and it makes no
+ // sense to add it here.
+ if (TheLoop->isLoopInvariant(Ptr))
+ continue;
+
Type *ElementTy = getLoadStoreType(&I);
// Currently, codegen doesn't support cases where the type size doesn't
Index: llvm/lib/Analysis/LoopAccessAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -2561,6 +2561,11 @@
if (!Ptr)
return;
+ // If the pointer is invariant then there is no stride and it makes no
+ // sense to add it here.
+ if (TheLoop->isLoopInvariant(Ptr))
+ return;
+
Value *Stride = getStrideFromPointer(Ptr, PSE->getSE(), TheLoop);
if (!Stride)
return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146958.510884.patch
Type: text/x-patch
Size: 1696 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230404/b585f58b/attachment.bin>
More information about the llvm-commits
mailing list