[llvm] e7f73c0 - [Attributor] Use `getPointerAddressSpace` to replace a cast followed by a `getAddressSpace`

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 19:57:48 PDT 2024


Author: Shilei Tian
Date: 2024-08-01T22:57:43-04:00
New Revision: e7f73c03dfe6c895b2dbe6d8d1d03546b87888c4

URL: https://github.com/llvm/llvm-project/commit/e7f73c03dfe6c895b2dbe6d8d1d03546b87888c4
DIFF: https://github.com/llvm/llvm-project/commit/e7f73c03dfe6c895b2dbe6d8d1d03546b87888c4.diff

LOG: [Attributor] Use `getPointerAddressSpace` to replace a cast followed by a `getAddressSpace`

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index f69054334c739..cd31c4be1c1da 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -12491,8 +12491,7 @@ struct AAAddressSpaceImpl : public AAAddressSpace {
   void initialize(Attributor &A) override {
     assert(getAssociatedType()->isPtrOrPtrVectorTy() &&
            "Associated value is not a pointer");
-    auto *PtrTy = cast<PointerType>(getAssociatedType());
-    if (PtrTy->getAddressSpace())
+    if (getAssociatedType()->getPointerAddressSpace())
       indicateOptimisticFixpoint();
   }
 


        


More information about the llvm-commits mailing list