diff options
author | Andrew Trick <atrick@apple.com> | 2011-06-29 03:13:40 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2011-06-29 03:13:40 +0000 |
commit | 11745d4c0276ccb5c64f83d6954b54c8ff2aec98 (patch) | |
tree | 11be986620f4d7240e0e489bc6eeca6f44925ce3 /test/Transforms/IndVarSimplify | |
parent | 2c0cbce763a258ac58590a8ca3c28ff722093fef (diff) | |
download | external_llvm-11745d4c0276ccb5c64f83d6954b54c8ff2aec98.zip external_llvm-11745d4c0276ccb5c64f83d6954b54c8ff2aec98.tar.gz external_llvm-11745d4c0276ccb5c64f83d6954b54c8ff2aec98.tar.bz2 |
indvars -disable-iv-rewrite: just because SCEV ignores casts doesn't
mean they can be removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134054 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/IndVarSimplify')
-rw-r--r-- | test/Transforms/IndVarSimplify/no-iv-rewrite.ll | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/Transforms/IndVarSimplify/no-iv-rewrite.ll b/test/Transforms/IndVarSimplify/no-iv-rewrite.ll index c35feef..462ff58 100644 --- a/test/Transforms/IndVarSimplify/no-iv-rewrite.ll +++ b/test/Transforms/IndVarSimplify/no-iv-rewrite.ll @@ -23,6 +23,7 @@ ph: ; sext should be eliminated while preserving gep inboundsness. ; CHECK-NOT: sext ; CHECK: getelementptr inbounds +; CHECK: exit loop: %i.02 = phi i32 [ 0, %ph ], [ %iinc, %loop ] %s.01 = phi i32 [ 0, %ph ], [ %sinc, %loop ] @@ -63,6 +64,7 @@ ph: ; CHECK: getelementptr inbounds ; %vall sext should obviously not be eliminated ; CHECK: sext +; CHECK: exit loop: %i.02 = phi i32 [ 0, %ph ], [ %iinc, %loop ] %s.01 = phi i64 [ 0, %ph ], [ %sinc, %loop ] @@ -106,6 +108,7 @@ ph: ; Preserve gep inboundsness, and don't factor it. ; CHECK: getelementptr inbounds i32* %ptriv, i32 1 ; CHECK-NOT: add +; CHECK: exit loop: %ptriv = phi i32* [ %first, %ph ], [ %ptrpost, %loop ] %ofs = sext i32 %idx to i64 @@ -121,3 +124,37 @@ exit: return: ret void } + +%struct = type { i32 } + +define void @bitcastiv(i32 %start, i32 %limit, i32 %step, %struct* %base) +nounwind +{ +entry: + br label %loop + +; CHECK: loop: +; +; Preserve casts +; CHECK: phi i32 +; CHECK: bitcast +; CHECK: getelementptr +; CHECK: exit +loop: + %iv = phi i32 [%start, %entry], [%next, %loop] + %p = phi %struct* [%base, %entry], [%pinc, %loop] + %adr = getelementptr %struct* %p, i32 0, i32 0 + store i32 3, i32* %adr + %pp = bitcast %struct* %p to i32* + store i32 4, i32* %pp + %pinc = getelementptr %struct* %p, i32 1 + %next = add i32 %iv, 1 + %cond = icmp ne i32 %next, %limit + br i1 %cond, label %loop, label %exit + +exit: + br label %return + +return: + ret void +}
\ No newline at end of file |