blob: ebf4f171a3d7de767d45901e41a66f4caea1eba7 [file] [log] [blame]
Chris Lattnerc7d7e0c2010-05-08 22:15:59 +00001; RUN: opt < %s -simplifycfg -S | FileCheck %s
Chris Lattnerf8131c92008-10-29 17:46:26 +00002; PR2967
3
4target datalayout =
5"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32"
6target triple = "i386-pc-linux-gnu"
7
Chris Lattnerc7d7e0c2010-05-08 22:15:59 +00008define void @test1(i32 %x) nounwind {
Chris Lattnerf8131c92008-10-29 17:46:26 +00009entry:
10 %0 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
11 br i1 %0, label %bb, label %return
12
13bb: ; preds = %entry
Eli Friedmanf03bb262011-08-12 22:50:01 +000014 %1 = load volatile i32* null
Chris Lattnerf8131c92008-10-29 17:46:26 +000015 unreachable
Chris Lattnerc7d7e0c2010-05-08 22:15:59 +000016
Chris Lattnerf8131c92008-10-29 17:46:26 +000017 br label %return
18return: ; preds = %entry
19 ret void
Chris Lattnerc7d7e0c2010-05-08 22:15:59 +000020; CHECK: @test1
Eli Friedmanf03bb262011-08-12 22:50:01 +000021; CHECK: load volatile
Chris Lattnerc7d7e0c2010-05-08 22:15:59 +000022}
23
24; rdar://7958343
25define void @test2() nounwind {
26entry:
27 store i32 4,i32* null
28 ret void
29
30; CHECK: @test2
31; CHECK: call void @llvm.trap
32; CHECK: unreachable
Chris Lattnerf8131c92008-10-29 17:46:26 +000033}
Benjamin Kramerc125fed2010-06-13 16:16:54 +000034
35; PR7369
36define void @test3() nounwind {
37entry:
Eli Friedmanf03bb262011-08-12 22:50:01 +000038 store volatile i32 4, i32* null
Benjamin Kramerc125fed2010-06-13 16:16:54 +000039 ret void
40
41; CHECK: @test3
Eli Friedmanf03bb262011-08-12 22:50:01 +000042; CHECK: store volatile i32 4, i32* null
Benjamin Kramerc125fed2010-06-13 16:16:54 +000043; CHECK: ret
44}