[PATCH] [x86] fix allowsMisalignedMemoryAccess() implementation

Quentin Colombet qcolombet at apple.com
Wed Jul 1 10:07:23 PDT 2015


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:1802
@@ +1801,3 @@
+  if (Fast) {
+    if (Alignment == 0 || Alignment >= VT.getSizeInBits() / 8)
+      *Fast = true;
----------------
jyknight wrote:
> 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.
My bad, you're right.

http://reviews.llvm.org/D10662

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






More information about the llvm-commits mailing list