1; RUN: opt < %s -simplifycfg -S | FileCheck %s 2; 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 8define void @test1(i32 %x) nounwind { 9entry: 10 %0 = icmp eq i32 %x, 0 ; <i1> [#uses=1] 11 br i1 %0, label %bb, label %return 12 13bb: ; preds = %entry 14 %1 = load volatile i32* null 15 unreachable 16 17 br label %return 18return: ; preds = %entry 19 ret void 20; CHECK-LABEL: @test1( 21; CHECK: load volatile 22} 23 24; rdar://7958343 25define void @test2() nounwind { 26entry: 27 store i32 4,i32* null 28 ret void 29 30; CHECK-LABEL: @test2( 31; CHECK: call void @llvm.trap 32; CHECK: unreachable 33} 34 35; PR7369 36define void @test3() nounwind { 37entry: 38 store volatile i32 4, i32* null 39 ret void 40 41; CHECK-LABEL: @test3( 42; CHECK: store volatile i32 4, i32* null 43; CHECK: ret 44} 45 46; Check store before unreachable. 47define void @test4(i1 %C, i32* %P) { 48; CHECK-LABEL: @test4( 49; CHECK: entry: 50; CHECK-NEXT: br i1 %C 51entry: 52 br i1 %C, label %T, label %F 53T: 54 store volatile i32 0, i32* %P 55 unreachable 56F: 57 ret void 58} 59 60; Check cmpxchg before unreachable. 61define void @test5(i1 %C, i32* %P) { 62; CHECK-LABEL: @test5( 63; CHECK: entry: 64; CHECK-NEXT: br i1 %C 65entry: 66 br i1 %C, label %T, label %F 67T: 68 cmpxchg volatile i32* %P, i32 0, i32 1 seq_cst seq_cst 69 unreachable 70F: 71 ret void 72} 73 74; Check atomicrmw before unreachable. 75define void @test6(i1 %C, i32* %P) { 76; CHECK-LABEL: @test6( 77; CHECK: entry: 78; CHECK-NEXT: br i1 %C 79entry: 80 br i1 %C, label %T, label %F 81T: 82 atomicrmw volatile xchg i32* %P, i32 0 seq_cst 83 unreachable 84F: 85 ret void 86} 87 88