[llvm] b0e06e1 - [Attributor][NFC] Modify isAssumedHeapToStack for const argument

Giorgis Georgakoudis via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 21 10:28:27 PDT 2021


Author: Giorgis Georgakoudis
Date: 2021-07-21T10:28:21-07:00
New Revision: b0e06e1fc0041d7d49af0a2339a4651445b2effc

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

LOG: [Attributor][NFC] Modify isAssumedHeapToStack for const argument

There is no need for a non-const argument interface and the const argument modification covers existing and upcoming use cases.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D106418

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/IPO/Attributor.h
    llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index 9f5007a211885..9d6681791dd2a 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -3537,7 +3537,7 @@ struct AAHeapToStack : public StateWrapper<BooleanState, AbstractAttribute> {
   AAHeapToStack(const IRPosition &IRP, Attributor &A) : Base(IRP) {}
 
   /// Returns true if HeapToStack conversion is assumed to be possible.
-  virtual bool isAssumedHeapToStack(CallBase &CB) const = 0;
+  virtual bool isAssumedHeapToStack(const CallBase &CB) const = 0;
 
   /// Create an abstract attribute view for the position \p IRP.
   static AAHeapToStack &createForPosition(const IRPosition &IRP, Attributor &A);

diff  --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 98bce21cf9653..0c4258ac70ee5 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -5707,7 +5707,7 @@ struct AAHeapToStackFunction final : public AAHeapToStack {
         ++BUILD_STAT_NAME(MallocCalls, Function);
   }
 
-  bool isAssumedHeapToStack(CallBase &CB) const override {
+  bool isAssumedHeapToStack(const CallBase &CB) const override {
     if (isValidState())
       if (AllocationInfo *AI = AllocationInfos.lookup(&CB))
         return AI->Status != AllocationInfo::INVALID;


        


More information about the llvm-commits mailing list