| 1 |
; RUN: opt -disable-output -passes='print<access-info>' %s 2>&1 | FileCheck %s --check-prefixes=CHECK,FULLDEPTH |
| 2 |
; RUN: opt -disable-output -passes='print<access-info>' -max-forked-scev-depth=2 %s 2>&1 | FileCheck %s --check-prefixes=CHECK,DEPTH2 |
| 3 |
|
| 4 |
define void @laa_common_output(ptr %Base, ptr %Dest, ptr %Preds) { |
| 5 |
entry: |
| 6 |
br label %for.body |
| 7 |
|
| 8 |
for.cond.cleanup: ; preds = %for.body |
| 9 |
ret void |
| 10 |
|
| 11 |
for.body: ; preds = %entry, %for.body |
| 12 |
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] |
| 13 |
%i.014 = phi i32 [ 0, %entry ], [ %add, %for.body ] |
| 14 |
%arrayidx = getelementptr inbounds i32, ptr %Preds, i64 %indvars.iv |
| 15 |
%0 = load i32, ptr %arrayidx, align 4 |
| 16 |
%cmp1.not = icmp eq i32 %0, 0 |
| 17 |
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 |
| 18 |
%add = add nuw nsw i32 %i.014, 1 |
| 19 |
%1 = trunc i64 %indvars.iv to i32 |
| 20 |
%offset.0 = select i1 %cmp1.not, i32 %add, i32 %1 |
| 21 |
%idxprom213 = zext i32 %offset.0 to i64 |
| 22 |
%arrayidx3 = getelementptr inbounds float, ptr %Base, i64 %idxprom213 |
| 23 |
%2 = load float, ptr %arrayidx3, align 4 |
| 24 |
%arrayidx5 = getelementptr inbounds float, ptr %Dest, i64 %indvars.iv |
| 25 |
store float %2, ptr %arrayidx5, align 4 |
| 26 |
%exitcond.not = icmp eq i64 %indvars.iv.next, 100 |
| 27 |
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body |
| 28 |
} |
| 29 |
|
| 30 |
define void @laa_divergent_output(ptr %Base, ptr %Dest, ptr %Preds, i64 %extra_offset) { |
| 31 |
entry: |
| 32 |
br label %for.body |
| 33 |
|
| 34 |
for.cond.cleanup: ; preds = %for.body |
| 35 |
ret void |
| 36 |
|
| 37 |
for.body: ; preds = %entry, %for.body |
| 38 |
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] |
| 39 |
%arrayidx = getelementptr inbounds i32, ptr %Preds, i64 %indvars.iv |
| 40 |
%0 = load i32, ptr %arrayidx, align 4 |
| 41 |
%cmp.not = icmp eq i32 %0, 0 |
| 42 |
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 |
| 43 |
%sel = select i1 %cmp.not, i64 %indvars.iv.next, i64 %indvars.iv |
| 44 |
%offset = add nuw nsw i64 %sel, %extra_offset |
| 45 |
%arrayidx3 = getelementptr inbounds float, ptr %Base, i64 %offset |
| 46 |
%1 = load float, ptr %arrayidx3, align 4 |
| 47 |
%arrayidx5 = getelementptr inbounds float, ptr %Dest, i64 %indvars.iv |
| 48 |
store float %1, ptr %arrayidx5, align 4 |
| 49 |
%exitcond.not = icmp eq i64 %indvars.iv.next, 100 |
| 50 |
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body |
| 51 |
} |