summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/ConstProp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2011-02-06 20:11:56 +0000
committerAnders Carlsson <andersca@mac.com>2011-02-06 20:11:56 +0000
commitd21b06a0db5f48ec96ad5c6072e4c70ad4b9beca (patch)
tree5dc5865b4a2ec985ffdae910cc8b1f230cc29cca /llvm/test/Transforms/ConstProp
parente866d44417a420a05d3ef9a04b6fd4a21b47a0e6 (diff)
downloadbcm5719-llvm-d21b06a0db5f48ec96ad5c6072e4c70ad4b9beca.tar.gz
bcm5719-llvm-d21b06a0db5f48ec96ad5c6072e4c70ad4b9beca.zip
When loading from a constant, fold inttoptr if the integer type and the resulting pointer type both have the same size.
llvm-svn: 124987
Diffstat (limited to 'llvm/test/Transforms/ConstProp')
-rw-r--r--llvm/test/Transforms/ConstProp/loads.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/test/Transforms/ConstProp/loads.ll b/llvm/test/Transforms/ConstProp/loads.ll
index 9fbba2b3552..74d80aa1872 100644
--- a/llvm/test/Transforms/ConstProp/loads.ll
+++ b/llvm/test/Transforms/ConstProp/loads.ll
@@ -120,3 +120,20 @@ define i1 @test13() {
; CHECK: @test13
; CHECK: ret i1 false
}
+
+@g6 = constant [2 x i8*] [i8* inttoptr (i64 1 to i8*), i8* inttoptr (i64 2 to i8*)]
+define i64 @test14() nounwind {
+entry:
+ %tmp = load i64* bitcast ([2 x i8*]* @g6 to i64*)
+ ret i64 %tmp
+; CHECK: @test14
+; CHECK: ret i64 1
+}
+
+define i64 @test15() nounwind {
+entry:
+ %tmp = load i64* bitcast (i8** getelementptr inbounds ([2 x i8*]* @g6, i32 0, i64 1) to i64*)
+ ret i64 %tmp
+; CHECK: @test15
+; CHECK: ret i64 2
+}
OpenPOWER on IntegriCloud