[PATCH] D15906: [Vectorization] Actually return from error case in isStridedPtr

Tim Shen via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 5 16:51:59 PST 2016


timshen updated this revision to Diff 44072.
timshen added a comment.

Done.

In order to reproduce the bug, it seems to require a nested loop structure. I've reduced the test file to 54 lines, in which the nested loops are pretty obvious to me. Do you think that's simple enough?


http://reviews.llvm.org/D15906

Files:
  lib/Analysis/LoopAccessAnalysis.cpp
  test/Analysis/LoopAccessAnalysis/interleave_innermost.ll

Index: test/Analysis/LoopAccessAnalysis/interleave_innermost.ll
===================================================================
--- /dev/null
+++ test/Analysis/LoopAccessAnalysis/interleave_innermost.ll
@@ -0,0 +1,54 @@
+; RUN: opt -O2 -S < %s | FileCheck %s
+; CHECK: %[[ENTRY:[0-9]+]] = getelementptr inbounds %StructA, %StructA* %{{[^ ]+}}, i64 -1, i32 1
+; CHECK: bitcast i32* %[[ENTRY]] to <{{[0-9]+}} x i32>*
+; XFAIL: *
+
+target datalayout = "e-m:e-i64:64-n32:64"
+target triple = "powerpc64le-unknown-linux-gnu"
+
+%StructA = type { i8, i32 }
+
+ at GlobalB = external global [1 x %StructA*], align 8
+
+; Function Attrs: norecurse noreturn nounwind
+define void @TestFoo() #0 {
+  br label %.loopexit5.outer
+
+.loopexit5.outer:                                 ; preds = %.loopexit, %0
+  %.pre = load %StructA*, %StructA** getelementptr ([1 x %StructA*], [1 x %StructA*]* @GlobalB, i64 0, i64 undef), align 8
+  br label %.lr.ph12
+
+.loopexit.loopexit:                               ; preds = %5
+  %scevgep19 = getelementptr i32, i32* %r.19, i64 undef
+  br label %.loopexit
+
+.loopexit:                                        ; preds = %.lr.ph12, %.loopexit.loopexit
+  %j.2.lcssa = phi i32 [ %j.111, %.lr.ph12 ], [ 0, %.loopexit.loopexit ]
+  %r.2.lcssa = phi i32* [ %r.19, %.lr.ph12 ], [ %scevgep19, %.loopexit.loopexit ]
+  %1 = icmp eq %StructA* %2, %.pre
+  br i1 %1, label %.loopexit5.outer, label %.lr.ph12
+
+.lr.ph12:                                         ; preds = %.loopexit, %.loopexit5.outer
+  %j.111 = phi i32 [ %j.2.lcssa, %.loopexit ], [ undef, %.loopexit5.outer ]
+  %f.110 = phi %StructA* [ %2, %.loopexit ], [ undef, %.loopexit5.outer ]
+  %r.19 = phi i32* [ %r.2.lcssa, %.loopexit ], [ undef, %.loopexit5.outer ]
+  %2 = getelementptr inbounds %StructA, %StructA* %f.110, i64 -1
+  %3 = icmp slt i32 %j.111, 0
+  br i1 %3, label %.lr.ph, label %.loopexit
+
+.lr.ph:                                           ; preds = %.lr.ph12
+  %4 = getelementptr inbounds %StructA, %StructA* %f.110, i64 -1, i32 1
+  br label %5
+
+; <label>:5                                       ; preds = %5, %.lr.ph
+  %j.27 = phi i32 [ %j.111, %.lr.ph ], [ %8, %5 ]
+  %r.26 = phi i32* [ %r.19, %.lr.ph ], [ %7, %5 ]
+  %6 = load i32, i32* %4, align 4
+  %7 = getelementptr inbounds i32, i32* %r.26, i64 1
+  store i32 %6, i32* %r.26, align 4
+  %8 = add nsw i32 %j.27, 1
+  %exitcond = icmp eq i32 %8, 0
+  br i1 %exitcond, label %.loopexit.loopexit, label %5
+}
+
+attributes #0 = { norecurse noreturn nounwind }
Index: lib/Analysis/LoopAccessAnalysis.cpp
===================================================================
--- lib/Analysis/LoopAccessAnalysis.cpp
+++ lib/Analysis/LoopAccessAnalysis.cpp
@@ -845,6 +845,7 @@
   if (Lp != AR->getLoop()) {
     DEBUG(dbgs() << "LAA: Bad stride - Not striding over innermost loop " <<
           *Ptr << " SCEV: " << *PtrScev << "\n");
+    return 0;
   }
 
   // The address calculation must not wrap. Otherwise, a dependence could be


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15906.44072.patch
Type: text/x-patch
Size: 3000 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160106/d8707fe5/attachment.bin>


More information about the llvm-commits mailing list