[llvm] r179774 - Allow misaligned stores in x86 fast-isel.

Derek Schuff dschuff at google.com
Thu Apr 18 10:41:09 PDT 2013


Author: dschuff
Date: Thu Apr 18 12:41:08 2013
New Revision: 179774

URL: http://llvm.org/viewvc/llvm-project?rev=179774&view=rev
Log:
Allow misaligned stores in x86 fast-isel.

In X86FastISel::X86SelectStore(), improperly aligned stores are rejected and
handled by the DAG-based ISel.  However, X86FastISel::X86SelectLoad() makes
no such requirement.  There doesn't appear to be an x86 architectural
correctness issue with allowing potentially unaligned store instructions.
This patch removes this restriction.

Patch by Jim Stichnot.

Added:
    llvm/trunk/test/CodeGen/X86/fast-isel-unaligned-store.ll
Modified:
    llvm/trunk/lib/Target/X86/X86FastISel.cpp

Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=179774&r1=179773&r2=179774&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Thu Apr 18 12:41:08 2013
@@ -693,11 +693,6 @@ bool X86FastISel::X86SelectStore(const I
   if (S->isAtomic())
     return false;
 
-  unsigned SABIAlignment =
-    TD.getABITypeAlignment(S->getValueOperand()->getType());
-  if (S->getAlignment() != 0 && S->getAlignment() < SABIAlignment)
-    return false;
-
   MVT VT;
   if (!isTypeLegal(I->getOperand(0)->getType(), VT, /*AllowI1=*/true))
     return false;

Added: llvm/trunk/test/CodeGen/X86/fast-isel-unaligned-store.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-unaligned-store.ll?rev=179774&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fast-isel-unaligned-store.ll (added)
+++ llvm/trunk/test/CodeGen/X86/fast-isel-unaligned-store.ll Thu Apr 18 12:41:08 2013
@@ -0,0 +1,18 @@
+; RUN: llc -mtriple=x86_64-none-linux -fast-isel -fast-isel-abort < %s | FileCheck %s
+; RUN: llc -mtriple=i686-none-linux -fast-isel -fast-isel-abort < %s | FileCheck %s
+
+define i32 @test_store_32(i32* nocapture %addr, i32 %value) {
+entry:
+  store i32 %value, i32* %addr, align 1
+  ret i32 %value
+}
+
+; CHECK: ret
+
+define i16 @test_store_16(i16* nocapture %addr, i16 %value) {
+entry:
+  store i16 %value, i16* %addr, align 1
+  ret i16 %value
+}
+
+; CHECK: ret





More information about the llvm-commits mailing list