• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -sccp -S %s | FileCheck %s
3
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?
9define float @test1(float %a, i1 %bc) {
10; CHECK-LABEL: @test1(
11; CHECK-NEXT:  entry:
12; CHECK-NEXT:    br i1 [[BC:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
13; CHECK:       bb1:
14; CHECK-NEXT:    br label [[EXIT:%.*]]
15; CHECK:       bb2:
16; CHECK-NEXT:    br label [[EXIT]]
17; CHECK:       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]]
22;
23entry:
24  br i1 %bc, label %bb1, label %bb2
25
26bb1:
27  br label %exit
28
29bb2:
30  br label %exit
31
32exit:
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
36  ret float %v.2
37}
38
39; Same as @test1, but with the incoming values switched.
40define float @test2(float %a, i1 %bc) {
41; CHECK-LABEL: @test2(
42; CHECK-NEXT:  entry:
43; CHECK-NEXT:    br i1 [[BC:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
44; CHECK:       bb1:
45; CHECK-NEXT:    br label [[EXIT:%.*]]
46; CHECK:       bb2:
47; CHECK-NEXT:    br label [[EXIT]]
48; CHECK:       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
52;
53entry:
54  br i1 %bc, label %bb1, label %bb2
55
56bb1:
57  br label %exit
58
59bb2:
60  br label %exit
61
62exit:
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
66  ret float %v.2
67}
68