diff options
author | Eli Friedman <efriedma@codeaurora.org> | 2016-11-21 22:35:34 +0000 |
---|---|---|
committer | Eli Friedman <efriedma@codeaurora.org> | 2016-11-21 22:35:34 +0000 |
commit | c0bba1a96dd40b02ae3eff265664276d4033ee8b (patch) | |
tree | 68bc3ed3ddc659ae624625bafc77ebaaee1868ba /llvm/test/Transforms/LoopReroll/basic.ll | |
parent | 6cad0115e1fd683b6673ff78c14956935ef7fd09 (diff) | |
download | bcm5719-llvm-c0bba1a96dd40b02ae3eff265664276d4033ee8b.tar.gz bcm5719-llvm-c0bba1a96dd40b02ae3eff265664276d4033ee8b.zip |
[LoopReroll] Make root-finding more aggressive.
Allow using an instruction other than a mul or phi as the base for
root-finding. For example, the included testcase includes a loop
which requires using a getelementptr as the base for root-finding.
Differential Revision: https://reviews.llvm.org/D26529
llvm-svn: 287588
Diffstat (limited to 'llvm/test/Transforms/LoopReroll/basic.ll')
-rw-r--r-- | llvm/test/Transforms/LoopReroll/basic.ll | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopReroll/basic.ll b/llvm/test/Transforms/LoopReroll/basic.ll index 0c8f5d8a3e8..096b17b303c 100644 --- a/llvm/test/Transforms/LoopReroll/basic.ll +++ b/llvm/test/Transforms/LoopReroll/basic.ll @@ -575,6 +575,37 @@ for.end: ; preds = %for.body ret void } +define void @gep-indexing(i32* nocapture %x) { +entry: + %call = tail call i32 @foo(i32 0) #1 + br label %for.body + +for.body: ; preds = %for.body, %entry + %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] + %0 = mul nsw i64 %indvars.iv, 3 + %arrayidx = getelementptr inbounds i32, i32* %x, i64 %0 + store i32 %call, i32* %arrayidx, align 4 + %arrayidx4 = getelementptr inbounds i32, i32* %arrayidx, i64 1 + store i32 %call, i32* %arrayidx4, align 4 + %arrayidx9 = getelementptr inbounds i32, i32* %arrayidx, i64 2 + store i32 %call, i32* %arrayidx9, align 4 + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 + %exitcond = icmp eq i64 %indvars.iv.next, 500 + br i1 %exitcond, label %for.end, label %for.body + +; CHECK-LABEL: @gep-indexing +; CHECK: for.body: +; CHECK-NEXT: %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] +; CHECK-NEXT: %scevgep = getelementptr i32, i32* %x, i64 %indvars.iv +; CHECK-NEXT: store i32 %call, i32* %scevgep, align 4 +; CHECK-NEXT: %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 +; CHECK-NEXT: %exitcond2 = icmp eq i32* %scevgep, %scevgep1 +; CHECK-NEXT: br i1 %exitcond2, label %for.end, label %for.body + +for.end: ; preds = %for.body + ret void +} + define void @unordered_atomic_ops(i32* noalias %buf_0, i32* noalias %buf_1) { ; CHECK-LABEL: @unordered_atomic_ops( |