1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -simplifycfg < %s | FileCheck %s
4 declare i8 @next_char();
6 define void @test_no_msan() {
7 ; CHECK-LABEL: @test_no_msan(
9 ; CHECK-NEXT: br label [[WHILE_BODY:%.*]]
11 ; CHECK-NEXT: br label [[WHILE_BODY_I:%.*]]
12 ; CHECK: while.body.i:
13 ; CHECK-NEXT: [[MAYBE_UNDEF:%.*]] = phi i1 [ undef, [[WHILE_BODY]] ], [ [[NEXT_MAYBE_UNDEF:%.*]], [[WHILE_BODY_I]] ]
14 ; CHECK-NEXT: [[C:%.*]] = call fastcc signext i8 @next_char()
15 ; CHECK-NEXT: [[C_10:%.*]] = icmp eq i8 [[C]], 10
16 ; CHECK-NEXT: [[C_13:%.*]] = icmp eq i8 [[C]], 13
17 ; CHECK-NEXT: [[C_10_OR_13:%.*]] = or i1 [[C_10]], [[C_13]]
18 ; CHECK-NEXT: [[NEXT_MAYBE_UNDEF]] = or i1 [[MAYBE_UNDEF]], [[C_10_OR_13]]
19 ; CHECK-NEXT: [[C_NOT_10_OR_13:%.*]] = xor i1 [[C_10_OR_13]], true
20 ; CHECK-NEXT: br i1 [[C_NOT_10_OR_13]], label [[WHILE_BODY_I]], label [[WHILE_BODY_I_BREAK:%.*]]
21 ; CHECK: while.body.i.break:
22 ; CHECK-NEXT: br i1 [[MAYBE_UNDEF]], label [[WHILE_BODY]], label [[SWITCH_EARLY_TEST:%.*]]
23 ; CHECK: switch.early.test:
24 ; CHECK-NEXT: switch i8 [[C]], label [[RETURN:%.*]] [
25 ; CHECK-NEXT: i8 13, label [[WHILE_BODY]]
26 ; CHECK-NEXT: i8 10, label [[WHILE_BODY]]
29 ; CHECK-NEXT: ret void
36 br label %while.body.i
39 %maybe_undef = phi i1 [ undef, %while.body ], [ %next_maybe_undef, %while.body.i ]
40 %c = call fastcc signext i8 @next_char()
41 %c_10 = icmp eq i8 %c, 10
42 %c_13 = icmp eq i8 %c, 13
43 %c_10_or_13 = or i1 %c_10, %c_13
44 %next_maybe_undef = or i1 %maybe_undef, %c_10_or_13
45 %c_not_10_or_13 = xor i1 %c_10_or_13, true
46 br i1 %c_not_10_or_13, label %while.body.i, label %while.body.i.break
49 ; NEXT_MAYBE_UNDEF is never undef if here
50 br i1 %next_maybe_undef, label %while.body, label %return
58 define void @test_msan() sanitize_memory {
59 ; CHECK-LABEL: @test_msan(
61 ; CHECK-NEXT: br label [[WHILE_BODY:%.*]]
63 ; CHECK-NEXT: br label [[WHILE_BODY_I:%.*]]
64 ; CHECK: while.body.i:
65 ; CHECK-NEXT: [[MAYBE_UNDEF:%.*]] = phi i1 [ undef, [[WHILE_BODY]] ], [ [[NEXT_MAYBE_UNDEF:%.*]], [[WHILE_BODY_I]] ]
66 ; CHECK-NEXT: [[C:%.*]] = call fastcc signext i8 @next_char()
67 ; CHECK-NEXT: [[C_10:%.*]] = icmp eq i8 [[C]], 10
68 ; CHECK-NEXT: [[C_13:%.*]] = icmp eq i8 [[C]], 13
69 ; CHECK-NEXT: [[C_10_OR_13:%.*]] = or i1 [[C_10]], [[C_13]]
70 ; CHECK-NEXT: [[NEXT_MAYBE_UNDEF]] = or i1 [[MAYBE_UNDEF]], [[C_10_OR_13]]
71 ; CHECK-NEXT: [[C_NOT_10_OR_13:%.*]] = xor i1 [[C_10_OR_13]], true
72 ; CHECK-NEXT: br i1 [[C_NOT_10_OR_13]], label [[WHILE_BODY_I]], label [[WHILE_BODY_I_BREAK:%.*]]
73 ; CHECK: while.body.i.break:
74 ; CHECK-NEXT: br i1 [[NEXT_MAYBE_UNDEF]], label [[WHILE_BODY]], label [[RETURN:%.*]]
76 ; CHECK-NEXT: ret void
83 br label %while.body.i
86 %maybe_undef = phi i1 [ undef, %while.body ], [ %next_maybe_undef, %while.body.i ]
87 %c = call fastcc signext i8 @next_char()
88 %c_10 = icmp eq i8 %c, 10
89 %c_13 = icmp eq i8 %c, 13
90 %c_10_or_13 = or i1 %c_10, %c_13
91 %next_maybe_undef = or i1 %maybe_undef, %c_10_or_13
92 %c_not_10_or_13 = xor i1 %c_10_or_13, true
93 br i1 %c_not_10_or_13, label %while.body.i, label %while.body.i.break
96 ; NEXT_MAYBE_UNDEF is never undef if here
97 br i1 %next_maybe_undef, label %while.body, label %return