1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=sccp -S %s | FileCheck %s
4 ; When marking the edge from bb2 -> exit as executable first, %p will be NaN
5 ; first and %v.1 will simplify to NaN. But when marking bb1 -> exit executable,
6 ; %p will we overdefined and %v.1 will be simplified to 0.0. Make sure we go to
7 ; overdefined, instead of crashing.
8 ; TODO: Can we do better, i.e. choose the 'conservative' 0.0 initially?
9 define float @test1(float %a, i1 %bc) {
10 ; CHECK-LABEL: @test1(
12 ; CHECK-NEXT: br i1 [[BC:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
14 ; CHECK-NEXT: br label [[EXIT:%.*]]
16 ; CHECK-NEXT: br label [[EXIT]]
18 ; CHECK-NEXT: [[P:%.*]] = phi float [ [[A:%.*]], [[BB1]] ], [ 0x7FF8000000000000, [[BB2]] ]
19 ; CHECK-NEXT: [[V_1:%.*]] = fmul float [[P]], 0.000000e+00
20 ; CHECK-NEXT: [[V_2:%.*]] = fadd float [[V_1]], 0xFFF8000000000000
21 ; CHECK-NEXT: ret float [[V_2]]
24 br i1 %bc, label %bb1, label %bb2
33 %p = phi float [ %a, %bb1 ], [ 0x7FF8000000000000, %bb2 ]
34 %v.1 = fmul float %p, 0.000000e+00
35 %v.2 = fadd float %v.1, 0xFFF8000000000000
39 ; Same as @test1, but with the incoming values switched.
40 define float @test2(float %a, i1 %bc) {
41 ; CHECK-LABEL: @test2(
43 ; CHECK-NEXT: br i1 [[BC:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
45 ; CHECK-NEXT: br label [[EXIT:%.*]]
47 ; CHECK-NEXT: br label [[EXIT]]
49 ; CHECK-NEXT: [[P:%.*]] = phi float [ 0x7FF8000000000000, [[BB1]] ], [ [[A:%.*]], [[BB2]] ]
50 ; CHECK-NEXT: [[V_1:%.*]] = fmul float [[P]], 0.000000e+00
51 ; CHECK-NEXT: ret float 0xFFF8000000000000
54 br i1 %bc, label %bb1, label %bb2
63 %p = phi float [ 0x7FF8000000000000, %bb1 ], [ %a, %bb2 ]
64 %v.1 = fmul float %p, 0.000000e+00
65 %v.2 = fadd float %v.1, 0xFFF8000000000000