1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -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