1f31811f2SFangrui Song; RUN: opt -basic-aa -loop-versioning -S < %s | FileCheck %s 2*7c19c89dSArthur Eubanks; RUN: opt -aa-pipeline=basic-aa -passes=loop-versioning -S < %s | FileCheck %s 3cee313d2SEric Christopher 4cee313d2SEric Christophertarget datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 5cee313d2SEric Christopher 6cee313d2SEric Christopher; Version this loop with overlap checks between a, c and b, c. 7cee313d2SEric Christopher 8cee313d2SEric Christopherdefine void @f(i32* %a, i32* %b, i32* %c) { 9cee313d2SEric Christopherentry: 10cee313d2SEric Christopher br label %for.body 11cee313d2SEric Christopher 12cee313d2SEric Christopher; CHECK: for.body.lver.check: 13cee313d2SEric Christopher; CHECK: icmp 14cee313d2SEric Christopher; CHECK: icmp 15cee313d2SEric Christopher; CHECK: icmp 16cee313d2SEric Christopher; CHECK: icmp 17cee313d2SEric Christopher; CHECK-NOT: icmp 18cee313d2SEric Christopher; CHECK: br i1 %memcheck.conflict, label %for.body.ph.lver.orig, label %for.body.ph 19cee313d2SEric Christopher 20cee313d2SEric Christopher; CHECK: for.body.ph.lver.orig: 21cee313d2SEric Christopher; CHECK: for.body.lver.orig: 22cee313d2SEric Christopher; CHECK: br i1 %exitcond.lver.orig, label %for.end, label %for.body.lver.orig 23cee313d2SEric Christopher; CHECK: for.body.ph: 24cee313d2SEric Christopher; CHECK: for.body: 25cee313d2SEric Christopher; CHECK: br i1 %exitcond, label %for.end, label %for.body 26cee313d2SEric Christopher; CHECK: for.end: 27cee313d2SEric Christopher 28cee313d2SEric Christopherfor.body: ; preds = %for.body, %entry 29cee313d2SEric Christopher %ind = phi i64 [ 0, %entry ], [ %add, %for.body ] 30cee313d2SEric Christopher 31cee313d2SEric Christopher %arrayidxA = getelementptr inbounds i32, i32* %a, i64 %ind 32cee313d2SEric Christopher %loadA = load i32, i32* %arrayidxA, align 4 33cee313d2SEric Christopher 34cee313d2SEric Christopher %arrayidxB = getelementptr inbounds i32, i32* %b, i64 %ind 35cee313d2SEric Christopher %loadB = load i32, i32* %arrayidxB, align 4 36cee313d2SEric Christopher 37cee313d2SEric Christopher %mulC = mul i32 %loadA, %loadB 38cee313d2SEric Christopher 39cee313d2SEric Christopher %arrayidxC = getelementptr inbounds i32, i32* %c, i64 %ind 40cee313d2SEric Christopher store i32 %mulC, i32* %arrayidxC, align 4 41cee313d2SEric Christopher 42cee313d2SEric Christopher %add = add nuw nsw i64 %ind, 1 43cee313d2SEric Christopher %exitcond = icmp eq i64 %add, 20 44cee313d2SEric Christopher br i1 %exitcond, label %for.end, label %for.body 45cee313d2SEric Christopher 46cee313d2SEric Christopherfor.end: ; preds = %for.body 47cee313d2SEric Christopher ret void 48cee313d2SEric Christopher} 49