diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-10-20 21:10:27 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-10-20 21:10:27 +0000 |
commit | 30815c536baacc07e925f0aef23a5395883173dc (patch) | |
tree | 2cbcf22585e99f8a87d12d5ff94f392c0d266819 /test/Transforms/InstCombine/getelementptr.ll | |
parent | 411bd29eea3c360d5b48a18a17b5e87f5671af0e (diff) |
Diffstat (limited to 'test/Transforms/InstCombine/getelementptr.ll')
-rw-r--r-- | test/Transforms/InstCombine/getelementptr.ll | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/getelementptr.ll b/test/Transforms/InstCombine/getelementptr.ll index 26c0e47f4b14..1c120ecbe9eb 100644 --- a/test/Transforms/InstCombine/getelementptr.ll +++ b/test/Transforms/InstCombine/getelementptr.ll @@ -472,3 +472,23 @@ entry: ; CHECK: @pr10322_f1 ; CHECK: %tmp2 = getelementptr inbounds %pr10322_t* %arrayidx8, i64 0, i32 0 } + +; Test that we combine the last two geps in this sequence, before we +; would wait for gep1 and gep2 to be combined and never combine 2 and 3. +%three_gep_t = type {i32} +%three_gep_t2 = type {%three_gep_t} + +define void @three_gep_f(%three_gep_t2* %x) { + %gep1 = getelementptr %three_gep_t2* %x, i64 2 + call void @three_gep_h(%three_gep_t2* %gep1) + %gep2 = getelementptr %three_gep_t2* %gep1, i64 0, i32 0 + %gep3 = getelementptr %three_gep_t* %gep2, i64 0, i32 0 + call void @three_gep_g(i32* %gep3) + +; CHECK: @three_gep_f +; CHECK: %gep3 = getelementptr %three_gep_t2* %gep1, i64 0, i32 0, i32 0 + ret void +} + +declare void @three_gep_g(i32*) +declare void @three_gep_h(%three_gep_t2*) |