mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-10 06:54:54 +00:00
d0d3ccc827
by a return that returns a constant, while elsewhere in the function another return instruction returns a different constant. This is a special case of accumulator recursion, so just generalize the existing logic a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108241 91177308-0d34-0410-b5e6-96231b3b80d8
21 lines
645 B
LLVM
21 lines
645 B
LLVM
; RUN: opt < %s -tailcallelim -S | FileCheck %s
|
|
; PR7328
|
|
; PR7506
|
|
define i32 @foo(i32 %x) {
|
|
; CHECK: define i32 @foo
|
|
; CHECK: %accumulator.tr = phi i32 [ 1, %entry ], [ 0, %body ]
|
|
entry:
|
|
%cond = icmp ugt i32 %x, 0 ; <i1> [#uses=1]
|
|
br i1 %cond, label %return, label %body
|
|
|
|
body: ; preds = %entry
|
|
%y = add i32 %x, 1 ; <i32> [#uses=1]
|
|
%tmp = call i32 @foo(i32 %y) ; <i32> [#uses=0]
|
|
; CHECK-NOT: call
|
|
ret i32 0
|
|
; CHECK: ret i32 %accumulator.tr
|
|
|
|
return: ; preds = %entry
|
|
ret i32 1
|
|
}
|