BranchInst currently represents both unconditional and conditional branches. However, these are quite different operations that are often handled separately. Therefore, split them into separate opcodes and classes to allow distinguishing these operations in the type system. Additionally, this also slightly improves compile-time performance.
59 lines
2.0 KiB
LLVM
59 lines
2.0 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
|
|
; RUN: opt -S -passes=normalize < %s | FileCheck %s
|
|
|
|
define double @foo(double %a0, double %a1) {
|
|
; CHECK-LABEL: define double @foo(
|
|
; CHECK-SAME: double [[A0:%.*]], double [[A1:%.*]]) {
|
|
; CHECK-NEXT: [[BB17254:.*:]]
|
|
; CHECK-NEXT: %"vl16288([[A0]], 2.000000e+00)" = fmul double [[A0]], 2.000000e+00
|
|
; CHECK-NEXT: %"op44980(vl16288)" = fmul double 6.000000e+00, %"vl16288([[A0]], 2.000000e+00)"
|
|
; CHECK-NEXT: [[A:%.*]] = fmul double [[A0]], [[A1]]
|
|
; CHECK-NEXT: [[C:%.*]] = fmul double 6.000000e+00, [[A]]
|
|
; CHECK-NEXT: ret double %"op44980(vl16288)"
|
|
;
|
|
entry:
|
|
%a = fmul double %a0, %a1
|
|
%b = fmul double %a0, 2.000000e+00
|
|
%c = fmul double %a, 6.000000e+00
|
|
%d = fmul double %b, 6.000000e+00
|
|
ret double %d
|
|
}
|
|
|
|
declare double @bir()
|
|
|
|
declare double @bar()
|
|
|
|
define double @baz(double %x) {
|
|
; CHECK-LABEL: define double @baz(
|
|
; CHECK-SAME: double [[A0:%.*]]) {
|
|
; CHECK-NEXT: [[BB76951:.*:]]
|
|
; CHECK-NEXT: [[IFCOND:%.*]] = fcmp one double [[A0]], 0.000000e+00
|
|
; CHECK-NEXT: br i1 [[IFCOND]], label %[[BB47054:.*]], label %[[BB470541:.*]]
|
|
; CHECK: [[BB47054]]:
|
|
; CHECK-NEXT: %"vl12417bir()" = call double @bir()
|
|
; CHECK-NEXT: br label %[[BB17254:.*]]
|
|
; CHECK: [[BB470541]]:
|
|
; CHECK-NEXT: %"vl26594bar()" = call double @bar()
|
|
; CHECK-NEXT: br label %[[BB17254]]
|
|
; CHECK: [[BB17254]]:
|
|
; CHECK-NEXT: %"op24395(vl12417, vl26594)" = phi double [ %"vl12417bir()", %[[BB47054]] ], [ %"vl26594bar()", %[[BB470541]] ]
|
|
; CHECK-NEXT: ret double %"op24395(vl12417, vl26594)"
|
|
;
|
|
entry:
|
|
%ifcond = fcmp one double %x, 0.000000e+00
|
|
br i1 %ifcond, label %then, label %else
|
|
|
|
then: ; preds = %entry
|
|
%calltmp = call double @bir()
|
|
br label %ifcont
|
|
|
|
else: ; preds = %entry
|
|
%calltmp1 = call double @bar()
|
|
br label %ifcont
|
|
|
|
ifcont: ; preds = %else, %then
|
|
%iftmp = phi double [ %calltmp, %then ], [ %calltmp1, %else ]
|
|
ret double %iftmp
|
|
}
|
|
|