[llvm] 2891b00 - [Attributor][NFC] Add `const` and missing state constructors

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 23:16:49 PDT 2020


Author: Johannes Doerfert
Date: 2020-04-24T01:08:23-05:00
New Revision: 2891b007e33136fd5d75b13a2c2eec6f8b5b2657

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

LOG: [Attributor][NFC] Add `const` and missing state constructors

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/IPO/Attributor.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index 3002a111a716..c4ace30f3d64 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -1360,6 +1360,9 @@ struct IntegerStateBase : public AbstractState {
 
   /// Return the worst possible representable state.
   static constexpr base_t getWorstState() { return WorstState; }
+  static constexpr base_t getWorstState(const IntegerStateBase &) {
+    return getWorstState();
+  }
 
   /// See AbstractState::isValidState()
   /// NOTE: For now we simply pretend that the worst possible state is invalid.
@@ -2273,6 +2276,16 @@ struct DerefState : AbstractState {
   static DerefState getBestState() { return DerefState(); }
   static DerefState getBestState(const DerefState &) { return getBestState(); }
 
+  /// Return the worst possible representable state.
+  static DerefState getWorstState() {
+    DerefState DS;
+    DS.indicatePessimisticFixpoint();
+    return DS;
+  }
+  static DerefState getWorstState(const DerefState &) {
+    return getWorstState();
+  }
+
   /// State representing for dereferenceable bytes.
   IncIntegerState<> DerefBytesState;
 
@@ -2363,13 +2376,13 @@ struct DerefState : AbstractState {
   }
 
   /// Equality for DerefState.
-  bool operator==(const DerefState &R) {
+  bool operator==(const DerefState &R) const {
     return this->DerefBytesState == R.DerefBytesState &&
            this->GlobalState == R.GlobalState;
   }
 
   /// Inequality for DerefState.
-  bool operator!=(const DerefState &R) { return !(*this == R); }
+  bool operator!=(const DerefState &R) const { return !(*this == R); }
 
   /// See IntegerStateBase::operator^=
   DerefState operator^=(const DerefState &R) {


        


More information about the llvm-commits mailing list