[PATCH] D133486: [LICM] Consider sret as writable object

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 13:38:26 PDT 2022


reames added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LICM.cpp:1899
 
-  // TODO: Also handle sret.
   if (auto *A = dyn_cast<Argument>(Object))
+    return A->hasByValAttr() || A->hasStructRetAttr();
----------------
If you want to be a bit more aggressive here, I believe that every dereferenceable argument satisfies this requirement.  Note that this is specific to the deref globally semantic, not the defer at point semantic.  Since the split on that never got through review, you probably don't want to rely on that.

You could directly implement the "at point" semantics here - which would be safe - by using dereferenceability in combination with !Value::canBeFreed.  We do have precedent for this in several places already.  




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

https://reviews.llvm.org/D133486



More information about the llvm-commits mailing list