Compiler projects using llvm
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -inline -S | FileCheck %s

; PR42084

define internal fastcc void @func4() {
; CHECK-LABEL: @func4(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    br label [[FOR_COND:%.*]]
; CHECK:       for.cond:
; CHECK-NEXT:    tail call void (...) @g()
; CHECK-NEXT:    br label [[FOR_COND]]
;
entry:
  br label %for.cond

for.cond:
  tail call void (...) @g()
  br label %for.cond
}

define internal fastcc void @func3() {
; CHECK-LABEL: @func3(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    tail call fastcc void @func4()
; CHECK-NEXT:    unreachable
;
entry:
  tail call fastcc void @func4()
  unreachable
}

define internal fastcc void @func2() {
; CHECK-LABEL: @func2(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    tail call fastcc void @func3()
; CHECK-NEXT:    unreachable
;
entry:
  tail call fastcc void @func3()
  unreachable
}

define internal fastcc void @func1() {
; CHECK-LABEL: @func1(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    tail call fastcc void @func2()
; CHECK-NEXT:    unreachable
;
entry:
  tail call fastcc void @func2()
  unreachable
}

define i32 @main() {
; CHECK-LABEL: @main(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    tail call fastcc void @func1()
; CHECK-NEXT:    unreachable
;
entry:
  tail call fastcc void @func1()
  unreachable
}

declare void @g(...)