[PATCH] [x86] fix allowsMisalignedMemoryAccess() implementation

James Y Knight jyknight at google.com
Wed Jul 1 08:58:03 PDT 2015


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4131
@@ +4130,3 @@
+      if (NumMemOps && AllowOverlap && VTSize >= 8 && NewVTSize < Size &&
+          // Specify 1-byte alignment because we know this access must
+          // be unaligned: it overlaps with the previous aligned access.
----------------
It still might actually have an alignment greater than 1 though, right? (I guess it probably doesn't really matter much, though.)

================
Comment at: lib/Target/X86/X86ISelLowering.cpp:1802
@@ +1801,3 @@
+  if (Fast) {
+    if (Alignment == 0 || Alignment >= VT.getSizeInBits() / 8)
+      *Fast = true;
----------------
qcolombet wrote:
> Shouldn't we check the alignment from the data layout?
Why does this even have a check for correct alignment at all? The function is "allowsMisalignedMemoryAccesses" -- the assumption being you already know your data isn't aligned.

I think it's the caller's responsibility to call DataLayout::getPrefTypeAlignment, isn't it?

Perhaps the static "allowableAlignment" helper function in DAGCombiner.cpp should be made more generally available, to make doing so easier.

http://reviews.llvm.org/D10662

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list