[llvm-commits] [llvm] r58423 - in /llvm/branches/release_24: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/2008-10-27-StackRealignment.ll

Tanya Lattner tonic at nondot.org
Wed Oct 29 22:55:00 PDT 2008


Author: tbrethou
Date: Thu Oct 30 00:55:00 2008
New Revision: 58423

URL: http://llvm.org/viewvc/llvm-project?rev=58423&view=rev
Log:
Merge from mainline.
Fix a nasty miscompilation of 176.gcc on linux/x86 where we synthesized
a memset using 16-byte XMM stores, but where the stack realignment code
didn't work.  Until it does (PR2962) disable use of xmm regs in memcpy
and memset formation for linux and other targets with insufficiently
aligned stacks.

This is part of PR2888

Added:
    llvm/branches/release_24/test/CodeGen/X86/2008-10-27-StackRealignment.ll
      - copied unchanged from r58317, llvm/trunk/test/CodeGen/X86/2008-10-27-StackRealignment.ll
Modified:
    llvm/branches/release_24/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/branches/release_24/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_24/lib/Target/X86/X86ISelLowering.cpp?rev=58423&r1=58422&r2=58423&view=diff

==============================================================================
--- llvm/branches/release_24/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/branches/release_24/lib/Target/X86/X86ISelLowering.cpp Thu Oct 30 00:55:00 2008
@@ -837,10 +837,15 @@
 MVT
 X86TargetLowering::getOptimalMemOpType(uint64_t Size, unsigned Align,
                                        bool isSrcConst, bool isSrcStr) const {
-  if ((isSrcConst || isSrcStr) && Subtarget->hasSSE2() && Size >= 16)
-    return MVT::v4i32;
-  if ((isSrcConst || isSrcStr) && Subtarget->hasSSE1() && Size >= 16)
-    return MVT::v4f32;
+  // FIXME: This turns off use of xmm stores for memset/memcpy on targets like
+  // linux.  This is because the stack realignment code can't handle certain
+  // cases like PR2962.  This should be removed when PR2962 is fixed.
+  if (Subtarget->getStackAlignment() >= 16) {
+    if ((isSrcConst || isSrcStr) && Subtarget->hasSSE2() && Size >= 16)
+      return MVT::v4i32;
+    if ((isSrcConst || isSrcStr) && Subtarget->hasSSE1() && Size >= 16)
+      return MVT::v4f32;
+  }
   if (Subtarget->is64Bit() && Size >= 8)
     return MVT::i64;
   return MVT::i32;





More information about the llvm-commits mailing list