[llvm-branch-commits] [llvm-tag] r97816 - in /llvm/tags/Apple/llvmCore-2324.8: ./ lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/tailcall2.ll

Stuart Hastings stuart at apple.com
Fri Mar 5 11:31:58 PST 2010


Author: stuart
Date: Fri Mar  5 13:31:58 2010
New Revision: 97816

URL: http://llvm.org/viewvc/llvm-project?rev=97816&view=rev
Log:
Tagging llvmCore-2324.8 as llvmCore-2324.6 PLUS the Hermes patch in r97800.

Added:
    llvm/tags/Apple/llvmCore-2324.8/
      - copied from r96996, llvm/branches/Apple/Hermes/
    llvm/tags/Apple/llvmCore-2324.8/test/CodeGen/X86/tailcall2.ll
      - copied unchanged from r97800, llvm/branches/Apple/Hermes/test/CodeGen/X86/tailcall2.ll
Modified:
    llvm/tags/Apple/llvmCore-2324.8/lib/Target/X86/X86ISelLowering.cpp   (contents, props changed)

Modified: llvm/tags/Apple/llvmCore-2324.8/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/tags/Apple/llvmCore-2324.8/lib/Target/X86/X86ISelLowering.cpp?rev=97816&r1=96996&r2=97816&view=diff
==============================================================================
--- llvm/tags/Apple/llvmCore-2324.8/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/tags/Apple/llvmCore-2324.8/lib/Target/X86/X86ISelLowering.cpp Fri Mar  5 13:31:58 2010
@@ -2246,7 +2246,8 @@
 bool MatchingStackOffset(SDValue Arg, unsigned Offset, ISD::ArgFlagsTy Flags,
                          MachineFrameInfo *MFI, const MachineRegisterInfo *MRI,
                          const X86InstrInfo *TII) {
-  int FI;
+  unsigned Bytes = Arg.getValueType().getSizeInBits() / 8;
+  int FI = INT_MAX;
   if (Arg.getOpcode() == ISD::CopyFromReg) {
     unsigned VR = cast<RegisterSDNode>(Arg.getOperand(1))->getReg();
     if (!VR || TargetRegisterInfo::isPhysicalRegister(VR))
@@ -2262,25 +2263,30 @@
       if ((Opcode == X86::LEA32r || Opcode == X86::LEA64r) &&
           Def->getOperand(1).isFI()) {
         FI = Def->getOperand(1).getIndex();
-        if (MFI->getObjectSize(FI) != Flags.getByValSize())
-          return false;
+        Bytes = Flags.getByValSize();
       } else
         return false;
     }
-  } else {
-    LoadSDNode *Ld = dyn_cast<LoadSDNode>(Arg);
-    if (!Ld)
+  } else if (LoadSDNode *Ld = dyn_cast<LoadSDNode>(Arg)) {
+    if (Flags.isByVal())
+      // ByVal argument is passed in as a pointer but it's now being
+      // derefernced. e.g.
+      // define @foo(%struct.X* %A) {
+      //   tail call @bar(%struct.X* byval %A)
+      // }
       return false;
     SDValue Ptr = Ld->getBasePtr();
     FrameIndexSDNode *FINode = dyn_cast<FrameIndexSDNode>(Ptr);
     if (!FINode)
       return false;
     FI = FINode->getIndex();
-  }
+  } else
+    return false;
 
+  assert(FI != INT_MAX);
   if (!MFI->isFixedObjectIndex(FI))
     return false;
-  return Offset == MFI->getObjectOffset(FI);
+  return Offset == MFI->getObjectOffset(FI) && Bytes == MFI->getObjectSize(FI);
 }
 
 /// IsEligibleForTailCallOptimization - Check whether the call is eligible

Propchange: llvm/tags/Apple/llvmCore-2324.8/lib/Target/X86/X86ISelLowering.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Fri Mar  5 13:31:58 2010
@@ -0,0 +1 @@
+/llvm/branches/Apple/Hermes/lib/Target/X86/X86ISelLowering.cpp:97800





More information about the llvm-branch-commits mailing list