[PATCH] D68852: [Attributor] Pointer privatization attribute (argument promotion)

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 09:24:44 PST 2019


jdoerfert marked an inline comment as done.
jdoerfert added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:4697
+    } else {
+      ReplacementValues.push_back(new LoadInst(PrivType, Base, "", IP));
+    }
----------------
efriedma wrote:
> jdoerfert wrote:
> > efriedma wrote:
> > > No alignment set on loads?
> > I'll add the alignment for the alloca below based on the alignment of the pointer it replaces. The loads and stores will be annotated by the next run of the Attributor automatically.
> > 
> > We can also consider not emitting it if we can prove it is not needed, though that will not always be the case and it will require an analysis we do not yet have (something like AAAccessTracker).
> > 
> > Finally, SROA should, in the good case, eliminate the alloca completely.
> > The loads and stores will be annotated by the next run of the Attributor automatically.
> 
> The default alignment of a load is the alignment of the load's type, as computed by the datalayout.  This might be too high, depending on the pointer.
> The default alignment of a load is the alignment of the load's type, as computed by the datalayout.

Sure.


> This might be too high, depending on the pointer.

How could that be? We create the pointer with a proper type (the alloca) below. Shouldn't the alloca take the default alignment into account when the memory is allocated?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68852/new/

https://reviews.llvm.org/D68852





More information about the llvm-commits mailing list