aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/InstCombine/getelementptr.ll
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-07-11 03:43:47 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-07-11 03:43:47 +0000
commitb5a12dd12fa3cd1026e9058a53089c29fb97f2fd (patch)
treea309f392d7a4c1a8635d31150489e47a55d4ee74 /test/Transforms/InstCombine/getelementptr.ll
parentf75ae4c977b8877bb8988109dc081d512874fb37 (diff)
downloadexternal_llvm-b5a12dd12fa3cd1026e9058a53089c29fb97f2fd.zip
external_llvm-b5a12dd12fa3cd1026e9058a53089c29fb97f2fd.tar.gz
external_llvm-b5a12dd12fa3cd1026e9058a53089c29fb97f2fd.tar.bz2
Don't duplicate the work done by a gep into a "bitcast" if the gep has
more than one use. Fixes PR10322. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134883 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/getelementptr.ll')
-rw-r--r--test/Transforms/InstCombine/getelementptr.ll16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/getelementptr.ll b/test/Transforms/InstCombine/getelementptr.ll
index aa2eba1..26c0e47 100644
--- a/test/Transforms/InstCombine/getelementptr.ll
+++ b/test/Transforms/InstCombine/getelementptr.ll
@@ -456,3 +456,19 @@ define i32* @test38(i32* %I, i32 %n) {
; CHECK: = sext i32 %n to i64
; CHECK: %A = getelementptr i32* %I, i64 %
}
+
+; Test that we don't duplicate work when the second gep is a "bitcast".
+%pr10322_t = type { i8* }
+declare void @pr10322_f2(%pr10322_t*)
+declare void @pr10322_f3(i8**)
+define void @pr10322_f1(%pr10322_t* %foo) {
+entry:
+ %arrayidx8 = getelementptr inbounds %pr10322_t* %foo, i64 2
+ call void @pr10322_f2(%pr10322_t* %arrayidx8) nounwind
+ %tmp2 = getelementptr inbounds %pr10322_t* %arrayidx8, i64 0, i32 0
+ call void @pr10322_f3(i8** %tmp2) nounwind
+ ret void
+
+; CHECK: @pr10322_f1
+; CHECK: %tmp2 = getelementptr inbounds %pr10322_t* %arrayidx8, i64 0, i32 0
+}