Adding RUN lines.
[oota-llvm.git] / test / CodeGen / Generic / 2003-05-30-BadPreselectPhi.ll
1 ; RUN: llvm-as -f %s -o - | llc
2
3 ;; Date:     May 28, 2003.
4 ;; From:     test/Programs/SingleSource/richards_benchmark.c
5 ;; Function: struct task *handlerfn(struct packet *pkt)
6 ;;
7 ;; Error:    PreSelection puts the arguments of the Phi just before
8 ;;           the Phi instead of in predecessor blocks.  This later
9 ;;           causes llc to produces an invalid register <NULL VALUE>
10 ;;           for the phi arguments.
11 ;;
12 ;; PreSelection Output:
13 ;; *** LLVM code after pre-selection for function handlerfn:
14 ;; 
15 ;; 
16 ;; %struct..task* %handlerfn(%struct..packet*) {
17 ;; ; <label>:0             ; No predecessors!
18 ;;         setne %struct..packet* %0, null         ; <bool>:0 [#uses=1]
19 ;;         br bool %0, label %1, label %2
20 ;; 
21 ;; ; <label>:1             ; preds = %0
22 ;;         br label %2
23 ;; 
24 ;; ; <label>:2             ; preds = %0, %1
25 ;;         %addrOfGlobal = getelementptr int* %v2, long 0          ; <int*> [#uses=1]
26 ;;         %addrOfGlobal1 = getelementptr int* %v1, long 0         ; <int*> [#uses=1]
27 ;;         phi int* [ %addrOfGlobal, %1 ], [ %addrOfGlobal1, %0 ]          ; <int*>:0 [#uses=1]
28 ;;         cast int* %0 to %struct..packet*                ; <%struct..packet*>:1 [#uses=1]
29 ;;         call void %append( %struct..packet* %0, %struct..packet* %1 )
30 ;;         ret %struct..task* null
31 ;; }
32 ;; llc: ../../../include/llvm/CodeGen/MachineInstr.h:294: int MachineOperand::getAllocatedRegNum() const: Assertion `hasAllocatedReg()' failed.
33 ;; 
34
35
36 target endian = little
37 target pointersize = 32
38         %struct..packet = type { %struct..packet*, int, int, int, [4 x sbyte] }
39         %struct..task = type { %struct..task*, int, int, %struct..packet*, int, %struct..task* (%struct..packet*)*, int, int }
40 %v1 = external global int
41 %v2 = external global int
42
43 implementation   ; Functions:
44
45 %struct..task* %handlerfn(%struct..packet* %pkt.2) {
46 entry:          ; No predecessors!
47         %tmp.1 = setne %struct..packet* %pkt.2, null
48         br bool %tmp.1, label %cond_false, label %cond_continue
49
50 cond_false:             ; preds = %entry
51         br label %cond_continue
52
53 cond_continue:          ; preds = %entry, %cond_false
54         %mem_tmp.0 = phi int* [ %v2, %cond_false ], [ %v1, %entry ]
55         %tmp.12 = cast int* %mem_tmp.0 to %struct..packet*
56         call void %append( %struct..packet* %pkt.2, %struct..packet* %tmp.12 )
57         ret %struct..task* null
58 }
59
60 declare void %append(%struct..packet*, %struct..packet*)