xref: /llvm-project/llvm/test/Transforms/IRNormalizer/reordering-basic.ll (revision 2e9f8696e9533fdd464e025bd504302fa1a22f14)
1*2e9f8696SJustin Fargnoli; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2*2e9f8696SJustin Fargnoli; RUN: opt -S -passes=normalize < %s | FileCheck %s
3*2e9f8696SJustin Fargnoli
4*2e9f8696SJustin Fargnolidefine double @foo(double %a0, double %a1) {
5*2e9f8696SJustin Fargnoli; CHECK-LABEL: define double @foo(
6*2e9f8696SJustin Fargnoli; CHECK-SAME: double [[A0:%.*]], double [[A1:%.*]]) {
7*2e9f8696SJustin Fargnoli; CHECK-NEXT:  [[BB17254:.*:]]
8*2e9f8696SJustin Fargnoli; CHECK-NEXT:    %"vl93562([[A0]], 2.000000e+00)" = fmul double [[A0]], 2.000000e+00
9*2e9f8696SJustin Fargnoli; CHECK-NEXT:    %"op95858(vl93562)" = fmul double 6.000000e+00, %"vl93562([[A0]], 2.000000e+00)"
10*2e9f8696SJustin Fargnoli; CHECK-NEXT:    [[A:%.*]] = fmul double [[A0]], [[A1]]
11*2e9f8696SJustin Fargnoli; CHECK-NEXT:    [[C:%.*]] = fmul double 6.000000e+00, [[A]]
12*2e9f8696SJustin Fargnoli; CHECK-NEXT:    ret double %"op95858(vl93562)"
13*2e9f8696SJustin Fargnoli;
14*2e9f8696SJustin Fargnolientry:
15*2e9f8696SJustin Fargnoli  %a = fmul double %a0, %a1
16*2e9f8696SJustin Fargnoli  %b = fmul double %a0, 2.000000e+00
17*2e9f8696SJustin Fargnoli  %c = fmul double %a, 6.000000e+00
18*2e9f8696SJustin Fargnoli  %d = fmul double %b, 6.000000e+00
19*2e9f8696SJustin Fargnoli  ret double %d
20*2e9f8696SJustin Fargnoli}
21*2e9f8696SJustin Fargnoli
22*2e9f8696SJustin Fargnolideclare double @bir()
23*2e9f8696SJustin Fargnoli
24*2e9f8696SJustin Fargnolideclare double @bar()
25*2e9f8696SJustin Fargnoli
26*2e9f8696SJustin Fargnolidefine double @baz(double %x) {
27*2e9f8696SJustin Fargnoli; CHECK-LABEL: define double @baz(
28*2e9f8696SJustin Fargnoli; CHECK-SAME: double [[A0:%.*]]) {
29*2e9f8696SJustin Fargnoli; CHECK-NEXT:  [[BB76951:.*:]]
30*2e9f8696SJustin Fargnoli; CHECK-NEXT:    [[IFCOND:%.*]] = fcmp one double [[A0]], 0.000000e+00
31*2e9f8696SJustin Fargnoli; CHECK-NEXT:    br i1 [[IFCOND]], label %[[BB91455:.*]], label %[[BB914551:.*]]
32*2e9f8696SJustin Fargnoli; CHECK:       [[BB91455]]:
33*2e9f8696SJustin Fargnoli; CHECK-NEXT:    %"vl15001bir()" = call double @bir()
34*2e9f8696SJustin Fargnoli; CHECK-NEXT:    br label %[[BB17254:.*]]
35*2e9f8696SJustin Fargnoli; CHECK:       [[BB914551]]:
36*2e9f8696SJustin Fargnoli; CHECK-NEXT:    %"vl69719bar()" = call double @bar()
37*2e9f8696SJustin Fargnoli; CHECK-NEXT:    br label %[[BB17254]]
38*2e9f8696SJustin Fargnoli; CHECK:       [[BB17254]]:
39*2e9f8696SJustin Fargnoli; CHECK-NEXT:    %"op19734(vl15001, vl69719)" = phi double [ %"vl15001bir()", %[[BB91455]] ], [ %"vl69719bar()", %[[BB914551]] ]
40*2e9f8696SJustin Fargnoli; CHECK-NEXT:    ret double %"op19734(vl15001, vl69719)"
41*2e9f8696SJustin Fargnoli;
42*2e9f8696SJustin Fargnolientry:
43*2e9f8696SJustin Fargnoli  %ifcond = fcmp one double %x, 0.000000e+00
44*2e9f8696SJustin Fargnoli  br i1 %ifcond, label %then, label %else
45*2e9f8696SJustin Fargnoli
46*2e9f8696SJustin Fargnolithen:       ; preds = %entry
47*2e9f8696SJustin Fargnoli  %calltmp = call double @bir()
48*2e9f8696SJustin Fargnoli  br label %ifcont
49*2e9f8696SJustin Fargnoli
50*2e9f8696SJustin Fargnolielse:       ; preds = %entry
51*2e9f8696SJustin Fargnoli  %calltmp1 = call double @bar()
52*2e9f8696SJustin Fargnoli  br label %ifcont
53*2e9f8696SJustin Fargnoli
54*2e9f8696SJustin Fargnoliifcont:     ; preds = %else, %then
55*2e9f8696SJustin Fargnoli  %iftmp = phi double [ %calltmp, %then ], [ %calltmp1, %else ]
56*2e9f8696SJustin Fargnoli  ret double %iftmp
57*2e9f8696SJustin Fargnoli}
58*2e9f8696SJustin Fargnoli
59