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 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 } + +@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 + +;