llvm/llvm/test/CodeGen/X86/coalescer-implicit-def-regression.ll

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
; RUN: llc -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s

; Check there's no assert in the coalescer from implicit-def operands
; on an IMPLICIT_DEF.


define i1 @_ZN4llvm8LLParser17parseDIEnumeratorERPNS_6MDNodeEb(i32 %arg) {
; CHECK-LABEL: _ZN4llvm8LLParser17parseDIEnumeratorERPNS_6MDNodeEb:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    xorl %ecx, %ecx
; CHECK-NEXT:    xorl %eax, %eax
; CHECK-NEXT:    cmpl $1, %edi
; CHECK-NEXT:    je .LBB0_1
; CHECK-NEXT:  # %bb.2: # %entry
; CHECK-NEXT:    testl %edi, %edi
; CHECK-NEXT:    jne .LBB0_4
; CHECK-NEXT:  # %bb.3: # %if.end.i.i.preheader
; CHECK-NEXT:    movb $1, %al
; CHECK-NEXT:    movl $1, %ecx
; CHECK-NEXT:  .LBB0_4: # %if.then.i.i
; CHECK-NEXT:    movb $1, %dl
; CHECK-NEXT:    testb %dl, %dl
; CHECK-NEXT:    je .LBB0_6
; CHECK-NEXT:  .LBB0_7: # %do.end
; CHECK-NEXT:    movq %rcx, 0
; CHECK-NEXT:    movb %al, 0
; CHECK-NEXT:    xorl %eax, %eax
; CHECK-NEXT:    retq
; CHECK-NEXT:  .LBB0_1:
; CHECK-NEXT:    xorl %edx, %edx
; CHECK-NEXT:    testb %dl, %dl
; CHECK-NEXT:    jne .LBB0_7
; CHECK-NEXT:  .LBB0_6: # %if.then8
; CHECK-NEXT:    xorl %eax, %eax
; CHECK-NEXT:    retq
entry:
  switch i32 %arg, label %if.then.i.i [
    i32 1, label %"_ZN4llvm8LLParser17parseMDFieldsImplIZNS0_17parseDIEnumeratorERPNS_6MDNodeEbE3$_0EEbT_RNS_5SMLocE.exit"
    i32 0, label %if.end.i.i.preheader
  ]

if.end.i.i.preheader:                             ; preds = %entry
  br label %if.then.i.i

if.then.i.i:                                      ; preds = %if.end.i.i.preheader, %entry
  %i = phi i64 [ 0, %entry ], [ 1, %if.end.i.i.preheader ]
  %i1 = phi i8 [ 0, %entry ], [ 1, %if.end.i.i.preheader ]
  br label %"_ZN4llvm8LLParser17parseMDFieldsImplIZNS0_17parseDIEnumeratorERPNS_6MDNodeEbE3$_0EEbT_RNS_5SMLocE.exit"

"_ZN4llvm8LLParser17parseMDFieldsImplIZNS0_17parseDIEnumeratorERPNS_6MDNodeEbE3$_0EEbT_RNS_5SMLocE.exit": ; preds = %if.then.i.i, %entry
  %i2 = phi i64 [ 0, %entry ], [ %i, %if.then.i.i ]
  %i3 = phi i8 [ 0, %entry ], [ %i1, %if.then.i.i ]
  %i4 = phi i8 [ 0, %entry ], [ 1, %if.then.i.i ]
  %tobool7.not = icmp eq i8 %i4, 0
  br i1 %tobool7.not, label %if.then8, label %do.end

if.then8:                                         ; preds = %"_ZN4llvm8LLParser17parseMDFieldsImplIZNS0_17parseDIEnumeratorERPNS_6MDNodeEbE3$_0EEbT_RNS_5SMLocE.exit"
  ret i1 false

do.end:                                           ; preds = %"_ZN4llvm8LLParser17parseMDFieldsImplIZNS0_17parseDIEnumeratorERPNS_6MDNodeEbE3$_0EEbT_RNS_5SMLocE.exit"
  store i64 %i2, ptr null, align 8
  store i8 %i3, ptr null, align 4
  ret i1 false
}