[llvm] Attributor: Add noalias.addrspace attribute for store and load (PR #136553)

via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 26 17:57:27 PDT 2025


================
@@ -6367,13 +6367,25 @@ struct AANoAliasAddrSpace
     return (AA->getIdAddr() == &ID);
   }
 
-  void setMask(uint32_t Mask) {
-    removeKnownBits(~Mask);
-    removeAssumedBits(~Mask);
+  void setMaxAddrSpace(unsigned MaxAS) {
+    MaxAddrSpace = MaxAS;
+    for (auto it = ASRanges.begin(); it != ASRanges.end();) {
+      if (it->first > MaxAS) {
+        it = ASRanges.erase(it);
+      } else if (it->second > MaxAS + 1) {
+        it->second = MaxAS + 1;
+      } else {
+        it++;
+      }
+    }
   }
 
   /// Unique ID (due to the unique address)
   static const char ID;
+
+protected:
+  SmallVector<std::pair<unsigned, unsigned>> ASRanges;
----------------
Shoreshen wrote:

Hi @arsenm , this method is similar as `AAAddressSpace`, which is using boolean state to indicate if the attribute need to be manifested and if the attribute is fixed.

This is a method discussed with @shiltian based on current framework...

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


More information about the llvm-commits mailing list