[llvm] [SimplifyCFG] Use isWritableObject() API (PR #110127)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 08:15:26 PDT 2024


================
@@ -892,7 +892,10 @@ bool llvm::isWritableObject(const Value *Object,
     return true;
 
   if (auto *A = dyn_cast<Argument>(Object)) {
-    if (A->hasAttribute(Attribute::Writable)) {
+    // Also require noalias, otherwise writability at function entry cannot be
+    // generalized to writability at other program points, even if the pointer
+    // does not escape.
+    if (A->hasAttribute(Attribute::Writable) && A->hasNoAliasAttr()) {
----------------
goldsteinn wrote:

Seems to the `noalias` check should be behind a bool. Think its liable to cause confusion that the API is assuming its callers intent when you can imagine scenarios where `noalias` is unnecessary.

https://github.com/llvm/llvm-project/pull/110127


More information about the llvm-commits mailing list