llvm/llvm/test/Transforms/EarlyCSE/nofpclass-phi-regression.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt -S -passes=early-cse %s | FileCheck %s

; Check for regression when phi support for computeKnownFPClass was
; first committed.
define void @compute_known_fpclass_phi_assert(i1 %cmp46, i1 %tobool51, ptr %a01) {
; CHECK-LABEL: define void @compute_known_fpclass_phi_assert
; CHECK-SAME: (i1 [[CMP46:%.*]], i1 [[TOBOOL51:%.*]], ptr [[A01:%.*]]) {
; CHECK-NEXT:  entry:
; CHECK-NEXT:    br label [[FOR_COND45:%.*]]
; CHECK:       for.cond45:
; CHECK-NEXT:    [[TMP0:%.*]] = phi double [ [[TMP1:%.*]], [[FOR_INC80:%.*]] ], [ 0.000000e+00, [[ENTRY:%.*]] ]
; CHECK-NEXT:    br i1 [[CMP46]], label [[FOR_BODY48:%.*]], label [[FOR_END82:%.*]]
; CHECK:       for.body48:
; CHECK-NEXT:    br i1 [[TOBOOL51]], label [[FOR_INC80]], label [[IF_THEN52:%.*]]
; CHECK:       if.then52:
; CHECK-NEXT:    store double 0.000000e+00, ptr [[A01]], align 8
; CHECK-NEXT:    br label [[FOR_INC80]]
; CHECK:       for.inc80:
; CHECK-NEXT:    [[TMP1]] = phi double [ 0.000000e+00, [[IF_THEN52]] ], [ [[TMP0]], [[FOR_BODY48]] ]
; CHECK-NEXT:    br label [[FOR_COND45]]
; CHECK:       for.end82:
; CHECK-NEXT:    [[MUL84:%.*]] = fmul double [[TMP0]], 0.000000e+00
; CHECK-NEXT:    ret void
;
entry:
  br label %for.cond45

for.cond45:                                       ; preds = %for.inc80, %entry
  %0 = phi double [ %1, %for.inc80 ], [ 0.000000e+00, %entry ]
  br i1 %cmp46, label %for.body48, label %for.end82

for.body48:                                       ; preds = %for.cond45
  br i1 %tobool51, label %for.inc80, label %if.then52

if.then52:                                        ; preds = %for.body48
  store double 0.000000e+00, ptr %a01, align 8
  br label %for.inc80

for.inc80:                                        ; preds = %if.then52, %for.body48
  %1 = phi double [ 0.000000e+00, %if.then52 ], [ %0, %for.body48 ]
  br label %for.cond45

for.end82:                                        ; preds = %for.cond45
  %mul84 = fmul double %0, 0.000000e+00
  %neg = fneg double %mul84
  ret void
}