aboutsummaryrefslogtreecommitdiffstats
path: root/test/Other/2002-02-24-InlineBrokePHINodes.ll
blob: 58e1b8c5f913ee16e4dff26ed3ad882b61a57aa5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
; Inlining used to break PHI nodes.  This tests that they are correctly updated 
; when a node is split around the call instruction.  The verifier caught the error.
;
; RUN: as < %s | opt -inline -verify
;
implementation

ulong "test"(ulong %X)
begin
	ret ulong %X
end

ulong "fib"(ulong %n)
begin
  %T = setlt ulong %n, 2       ; {bool}:0
  br bool %T, label %BaseCase, label %RecurseCase

RecurseCase:
  %result = call ulong %test(ulong %n)
  br label %BaseCase

BaseCase:
  %X = phi ulong [1, %0], [2, %RecurseCase]
  ret ulong %X
end