[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Jan 8 17:16:36 PST 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.8 -> 1.9
---
Log message:

Handle static alloca arguments to PHI nodes.


---
Diffs of the changes:  (+8 -3)

Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.8 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.9
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.8	Sat Jan  8 18:00:49 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Sat Jan  8 19:16:24 2005
@@ -836,8 +836,7 @@
   // blocks are available as virtual registers.
   for (BasicBlock::iterator I = LLVMBB->begin(), E = LLVMBB->end(); I != E;++I)
     if (!I->use_empty()) {
-      std::map<const Value*, unsigned>::iterator VMI =
-        FuncInfo.ValueMap.find(I);
+      std::map<const Value*, unsigned>::iterator VMI =FuncInfo.ValueMap.find(I);
       if (VMI != FuncInfo.ValueMap.end())
         CopyValueToVirtualRegister(SDL, I, VMI->second);
     }
@@ -878,7 +877,13 @@
           Reg = RegOut;
         } else {
           Reg = FuncInfo.ValueMap[PHIOp];
-          assert(Reg && "Didn't codegen value into a register!??");
+          if (Reg == 0) {
+            assert(isa<AllocaInst>(PHIOp) && 
+                   FuncInfo.StaticAllocaMap.count(cast<AllocaInst>(PHIOp)) &&
+                   "Didn't codegen value into a register!??");
+            Reg = FuncInfo.CreateRegForValue(PHIOp);
+            CopyValueToVirtualRegister(SDL, PHIOp, Reg);
+          }
         }
         
         // Remember that this register needs to added to the machine PHI node as






More information about the llvm-commits mailing list