[PATCH] D133192: [LICM] Allow load-only scalar promotion in the presence of aliasing loads

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 07:15:20 PST 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LICM.cpp:2236
   // We're only interested in must-alias sets that contain a mod.
-  SmallVector<const AliasSet *, 8> Sets;
+  SmallVector<std::pair<const AliasSet *, bool>, 8> Sets;
   for (AliasSet &AS : AST)
----------------
reames wrote:
> I think you can use a separate set to track the bool property until return.  This might be worthwhile as std::pair<ptr, bool> is pretty space inefficient.  (i.e. use something closer to struct of arrays than array of structs)
> 
> Or could we use a tagged pointer here?  That would reduce space wastage to zero.  
Don't think this makes much of a practical difference, but I've switched this to use a PointerIntPair.


================
Comment at: llvm/lib/Transforms/Scalar/LICM.cpp:2260
+  for (auto [Set, HasReadsOutsideSet] : Sets) {
     SmallSetVector<Value *, 8> PointerMustAliases;
     for (const auto &ASI : *Set)
----------------
reames wrote:
> Surely we have a more efficient way to copy a small set vector?
This is copying from an AliasSet though, so I don't think so.


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

https://reviews.llvm.org/D133192



More information about the llvm-commits mailing list