blob: 26d31d77ac7163ccd2f36a93382c75cb550cce5a [file] [log] [blame]
Florian Hahn00624412020-03-21 23:38:37 +00001; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -sccp -S | FileCheck %s
3
4; Test some XOR simplifications / range propagation.
5define void@xor1(i1 %cmp) {
6; CHECK-LABEL: @xor1(
7; CHECK-NEXT: entry:
8; CHECK-NEXT: br i1 [[CMP:%.*]], label [[IF_TRUE:%.*]], label [[END:%.*]]
9; CHECK: if.true:
10; CHECK-NEXT: br label [[END]]
11; CHECK: end:
12; CHECK-NEXT: call void @use(i1 true)
13; CHECK-NEXT: call void @use(i1 false)
14; CHECK-NEXT: call void @use(i1 false)
15; CHECK-NEXT: call void @use(i1 true)
16; CHECK-NEXT: ret void
17;
18entry:
19 br i1 %cmp, label %if.true, label %end
20
21if.true:
22 br label %end
23
24end:
25 %p = phi i32 [ 11, %entry ], [ 11, %if.true]
26 %xor.1 = xor i32 %p, %p
27 %c.1 = icmp eq i32 %xor.1, 0
28 call void @use(i1 %c.1)
29 %c.2 = icmp eq i32 %xor.1, 10
30 call void @use(i1 %c.2)
31 %xor.2 = xor i32 %p, 1
32 %c.3 = icmp eq i32 %xor.2, 11
33 call void @use(i1 %c.3)
34 %c.4 = icmp eq i32 %xor.2, 10
35 call void @use(i1 %c.4)
36 ret void
37}
38
39declare void @use(i1)