fix rdar://9289583 - fast isel should handle non-canonical commutative binops
[oota-llvm.git] / test / Transforms / ConstProp / loads.ll
index 9151d256b02499a3584157b4174b910016c9e776..74d80aa18729033fc30c14a4a1648b28288008a8 100644 (file)
@@ -110,3 +110,30 @@ define i16 @test12() {
 ; CHECK: @test12
 ; CHECK: ret i16 98
 }
+
+
+; PR5978
+@g5 = constant i8 4
+define i1 @test13() {
+  %A = load i1* bitcast (i8* @g5 to i1*)
+  ret i1 %A
+; 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
+}