recursion.ll 641 Bytes
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -ipsccp -deadargelim -S | FileCheck %s

; CHECK-NOT: %X

define internal i32 @foo(i32 %X) {
; CHECK-LABEL: @foo(
; CHECK-NEXT:    [[Y:%.*]] = call i32 @foo()
; CHECK-NEXT:    [[Z:%.*]] = add i32 [[Y]], 1
; CHECK-NEXT:    ret i32 [[Z]]
;
  %Y = call i32 @foo( i32 %X )            ; <i32> [#uses=1]
  %Z = add i32 %Y, 1              ; <i32> [#uses=1]
  ret i32 %Z
}

define void @bar() {
; CHECK-LABEL: @bar(
; CHECK-NEXT:    [[TMP1:%.*]] = call i32 @foo()
; CHECK-NEXT:    ret void
;
  call i32 @foo( i32 17 )         ; <i32>:1 [#uses=0]
  ret void
}