[PATCH] D146958: [SCEV] Do not plant SCEV checks unnecessarily

Paul Osmialowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 13:48:09 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
pawosm01 marked an inline comment as done.
Closed by commit rG9cf1881f8f12: [SCEV] Do not plant SCEV checks unnecessarily (authored by pawosm01).

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/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
@@ -5,8 +5,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
@@ -45,8 +44,7 @@
 
 define void @bar(ptr %pout, ptr %pin, i64 %val0, i64 %val1, i64 %val2) {
 ; CHECK-LABEL: @bar(
-; 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/LoopAccessAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -2642,6 +2642,11 @@
   if (!S)
     return nullptr;
 
+  // If the pointer is invariant then there is no stride and it makes no
+  // sense to add it here.
+  if (Lp != S->getLoop())
+    return nullptr;
+
   V = S->getStepRecurrence(*SE);
   if (!V)
     return nullptr;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146958.516894.patch
Type: text/x-patch
Size: 1400 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230425/8de0d0ad/attachment.bin>


More information about the llvm-commits mailing list