Do everything up to generating code to try to get a register for
authorEric Christopher <echristo@apple.com>
Tue, 20 Mar 2012 01:07:58 +0000 (01:07 +0000)
committerEric Christopher <echristo@apple.com>
Tue, 20 Mar 2012 01:07:58 +0000 (01:07 +0000)
a variable. The previous code would break the debug info changing
code invariant. This will regress debug info for arguments where
we elide the alloca created.

Fixes rdar://11066468

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

lib/CodeGen/SelectionDAG/FastISel.cpp

index c5efde37462839da2b9ad714834f5f333807732b..9f4a44a4927250aa004cc7b5dd11672e4a03ba35 100644 (file)
@@ -590,7 +590,12 @@ bool FastISel::SelectCall(const User *I) {
         Reg = TRI.getFrameRegister(*FuncInfo.MF);
     }
     if (!Reg)
-      Reg = getRegForValue(Address);
+      Reg = lookUpRegForValue(Address);
+
+    if (!Reg && isa<Instruction>(Address) &&
+        (!isa<AllocaInst>(Address) ||
+         !FuncInfo.StaticAllocaMap.count(cast<AllocaInst>(Address))))
+      Reg = FuncInfo.InitializeRegForValue(Address);
 
     if (Reg)
       BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,