In bottom-up mode, defer the materialization of local constant values.
authorDan Gohman <gohman@apple.com>
Thu, 6 May 2010 00:02:14 +0000 (00:02 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 6 May 2010 00:02:14 +0000 (00:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103139 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/FastISel.cpp

index 078e5fd3c07e95fad4d563463523671d26ae78b0..9cc6f1b5ec468802df4c02fc979fa238fca93dca 100644 (file)
@@ -84,6 +84,17 @@ unsigned FastISel::getRegForValue(const Value *V) {
   if (Reg != 0)
     return Reg;
 
+  // In bottom-up mode, just create the virtual register which will be used
+  // to hold the value. It will be materialized later.
+  if (IsBottomUp) {
+    Reg = createResultReg(TLI.getRegClassFor(VT));
+    if (isa<Instruction>(V))
+      ValueMap[V] = Reg;
+    else
+      LocalValueMap[V] = Reg;
+    return Reg;
+  }
+
   return materializeRegForValue(V, VT);
 }