1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=newgvn -S | FileCheck %s
7 ; CHECK-NEXT: br label [[BLOCK2:%.*]]
9 ; CHECK-NEXT: ret i32 0
12 %z1 = bitcast i32 0 to i32
15 %z2 = bitcast i32 0 to i32
19 ; Test that we simplify selects properly
20 define i64 @simplifyselect(i64 %x, i64 %y, i1 %c1, i1 %c2, i1 %zzz) {
21 ; CHECK-LABEL: @simplifyselect(
22 ; CHECK-NEXT: [[SHARED:%.*]] = add i64 [[X:%.*]], [[Y:%.*]]
23 ; CHECK-NEXT: [[R1:%.*]] = select i1 [[C1:%.*]], i64 [[SHARED]], i64 [[X]]
24 ; CHECK-NEXT: [[R2:%.*]] = select i1 [[C2:%.*]], i64 [[SHARED]], i64 [[Y]]
25 ; CHECK-NEXT: [[R:%.*]] = add i64 [[R1]], [[R2]]
26 ; CHECK-NEXT: ret i64 [[R]]
28 %shared = add i64 %x, %y
29 %r1 = select i1 %c1, i64 %shared, i64 %x
30 %r2 = select i1 %c2, i64 %shared, i64 %y
31 %tmp = select i1 %c2, i64 %x, i64 0
32 %r2_eq2 = select i1 %zzz, i64 %r2, i64 %r2
33 %r = add i64 %r1, %r2_eq2
37 define i8 @simplify_add_poison(i8 %x) {
38 ; CHECK-LABEL: @simplify_add_poison(
39 ; CHECK-NEXT: ret i8 poison
41 %r = add i8 poison, %x
45 define i8 @simplify_xor_poison(i8 %x) {
46 ; CHECK-LABEL: @simplify_xor_poison(
47 ; CHECK-NEXT: ret i8 poison
49 %r = xor i8 poison, %x
53 define i8 @simplify_sdiv_poison(i8 %x) {
54 ; CHECK-LABEL: @simplify_sdiv_poison(
55 ; CHECK-NEXT: ret i8 poison
57 %r = sdiv i8 poison, %x
61 define i8 @simplify_urem_poison(i8 %x) {
62 ; CHECK-LABEL: @simplify_urem_poison(
63 ; CHECK-NEXT: ret i8 poison
65 %r = urem i8 %x, poison