[llvm] Attributor: Add noalias.addrspace attribute for store and load (PR #136553)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 22 11:24:46 PDT 2025
================
@@ -12784,6 +12785,173 @@ struct AAAddressSpaceCallSiteArgument final : AAAddressSpaceImpl {
};
} // namespace
+/// ------------------------ No Alias Address Space ---------------------------
+namespace {
+struct AANoAliasAddrSpaceImpl : public AANoAliasAddrSpace {
+ AANoAliasAddrSpaceImpl(const IRPosition &IRP, Attributor &A)
+ : AANoAliasAddrSpace(IRP, A) {}
+
+ void initialize(Attributor &A) override {
+ assert(getAssociatedType()->isPtrOrPtrVectorTy() &&
+ "Associated value is not a pointer");
+
+ if (!A.getInfoCache().getFlatAddressSpace().has_value()) {
+ indicatePessimisticFixpoint();
+ return;
+ }
+
+ unsigned FlatAS = A.getInfoCache().getFlatAddressSpace().value();
+ unsigned AS = getAssociatedType()->getPointerAddressSpace();
+ if (AS != FlatAS) {
+ removeAssumedBits(1 << AS);
+ indicateOptimisticFixpoint();
+ }
+ }
+
+ ChangeStatus updateImpl(Attributor &A) override {
+ unsigned FlatAS = A.getInfoCache().getFlatAddressSpace().value();
+ uint32_t OrigAssumed = getAssumed();
+
+ auto CheckAddressSpace = [&](Value &Obj) {
+ if (isa<UndefValue>(&Obj) || isa<PoisonValue>(&Obj))
+ return true;
----------------
arsenm wrote:
`isa<UndefValue>` covers the poison case. My point was these need different handling
https://github.com/llvm/llvm-project/pull/136553
More information about the llvm-commits
mailing list