Don't forward-declare registers for static allocas, which we'll
authorDan Gohman <gohman@apple.com>
Wed, 7 Jul 2010 23:52:58 +0000 (23:52 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 7 Jul 2010 23:52:58 +0000 (23:52 +0000)
prefer to materialize as local constants. This fixes the clang
bootstrap abort.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107840 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/FastISel.cpp

index 5a245122775d9845f57716f5394c5811c9a110f1..5b566f675fe0d65b977f2f4951567c9328874767 100644 (file)
@@ -120,7 +120,9 @@ unsigned FastISel::getRegForValue(const Value *V) {
 
   // In bottom-up mode, just create the virtual register which will be used
   // to hold the value. It will be materialized later.
-  if (isa<Instruction>(V)) {
+  if (isa<Instruction>(V) &&
+      (!isa<AllocaInst>(V) ||
+       !FuncInfo.StaticAllocaMap.count(cast<AllocaInst>(V)))) {
     Reg = createResultReg(TLI.getRegClassFor(VT));
     FuncInfo.ValueMap[V] = Reg;
     return Reg;