FastISel support for debug info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56610 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 9e12a27..cbb1762 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -718,12 +718,27 @@
     BasicBlock::iterator BI = Begin;
 
     // Lower any arguments needed in this block if this is the entry block.
-    if (LLVMBB == &Fn.getEntryBlock())
+    bool SuppressFastISel = false;
+    if (LLVMBB == &Fn.getEntryBlock()) {
       LowerArguments(LLVMBB);
 
+      // If any of the arguments has the byval attribute, forgo
+      // fast-isel in the entry block.
+      if (EnableFastISel) {
+        unsigned j = 1;
+        for (Function::arg_iterator I = Fn.arg_begin(), E = Fn.arg_end();
+             I != E; ++I, ++j)
+          if (Fn.paramHasAttr(j, ParamAttr::ByVal)) {
+            cerr << "FastISel skips entry block due to byval argument";
+            SuppressFastISel = true;
+            break;
+          }
+      }
+    }
+
     // Before doing SelectionDAG ISel, see if FastISel has been requested.
     // FastISel doesn't support EH landing pads, which require special handling.
-    if (EnableFastISel && !BB->isLandingPad()) {
+    if (EnableFastISel && !SuppressFastISel && !BB->isLandingPad()) {
       if (FastISel *F = TLI.createFastISel(*FuncInfo->MF, MMI,
                                            FuncInfo->ValueMap,
                                            FuncInfo->MBBMap,
@@ -761,6 +776,9 @@
 
           // Then handle certain instructions as single-LLVM-Instruction blocks.
           if (isa<CallInst>(BI)) {
+            cerr << "FastISel missed call: ";
+            BI->dump();
+
             if (BI->getType() != Type::VoidTy) {
               unsigned &R = FuncInfo->ValueMap[BI];
               if (!R)