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