[PATCH] [ARM] Align stack objects passed to memory intrinsics

hfinkel at anl.gov hfinkel at anl.gov
Wed Mar 11 06:52:51 PDT 2015


REPOSITORY
  rL LLVM

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:1252
@@ +1251,3 @@
+          AI->getAlignment() < PrefAlign &&
+          TD->getTypeAllocSize(AI->getAllocatedType()) - Offset2 >= MinSize)
+        AI->setAlignment(PrefAlign);
----------------
john.brawn wrote:
> hfinkel wrote:
> > If this is not an inbounds GEP, then this subtraction could underflow (it could overflow otherwise too, but without inbounds it could underflow even in a case where the code does not have undefined behavior). I recommend making sure the value being subtracted is not greater than the alloc size.
> > 
> > Please add a test case for this.
> > 
> stripAndAccumulateInBoundsConstantOffsets will stop if it hits a non-inbound GEP, so we wouldn't get here in that case. Adding a test sound like a good idea though, I'll do that.
Yea, but even for an inbounds gep, we should do the right thing (the code may have undefined behavior, but having that reset the alignment of some objects seems a bit silly).

http://reviews.llvm.org/D7908

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






More information about the llvm-commits mailing list