; CHECK: load volatile
}
+define void @test1_no_null_opt(i32 %x) nounwind #0 {
+entry:
+ %0 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ br i1 %0, label %bb, label %return
+
+bb: ; preds = %entry
+ %1 = load volatile i32, i32* null
+ unreachable
+
+ br label %return
+return: ; preds = %entry
+ ret void
+; CHECK-LABEL: @test1_no_null_opt(
+; CHECK: load volatile
+; CHECK: unreachable
+}
+
; rdar://7958343
define void @test2() nounwind {
entry:
store i32 4,i32* null
ret void
-
+
; CHECK-LABEL: @test2(
; CHECK: call void @llvm.trap
; CHECK: unreachable
}
+define void @test2_no_null_opt() nounwind #0 {
+entry:
+ store i32 4,i32* null
+ ret void
+; CHECK-LABEL: @test2_no_null_opt(
+; CHECK: store i32 4, i32* null
+; CHECK-NOT: call void @llvm.trap
+; CHECK: ret
+}
+
; PR7369
define void @test3() nounwind {
entry:
; CHECK: ret
}
+define void @test3_no_null_opt() nounwind #0 {
+entry:
+ store volatile i32 4, i32* null
+ ret void
+
+; CHECK-LABEL: @test3_no_null_opt(
+; CHECK: store volatile i32 4, i32* null
+; CHECK: ret
+}
+
; Check store before unreachable.
define void @test4(i1 %C, i32* %P) {
; CHECK-LABEL: @test4(
ret void
}
+attributes #0 = { "null-pointer-is-valid"="true" }