[llvm] 3dbb5eb - [ConstraintElimination] Move ConstraintInfo after ConstraintTy. (NFC)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 29 01:59:34 PDT 2022


Author: Florian Hahn
Date: 2022-03-29T09:59:03+01:00
New Revision: 3dbb5eb2cd7002c9bb7926477714ca99d7d9c659

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

LOG: [ConstraintElimination] Move ConstraintInfo after ConstraintTy. (NFC)

Code movement to it slightly easier to use ConstraintTy & co in
ConstraintInfo directly, for follow-up patches.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/ConstraintElimination.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
index dbc7a534467b1..a0f990d6165e8 100644
--- a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
@@ -46,39 +46,7 @@ static int64_t MinSignedConstraintValue = std::numeric_limits<int64_t>::min();
 
 namespace {
 
-/// Wrapper encapsulating separate constraint systems and corresponding value
-/// mappings for both unsigned and signed information. Facts are added to and
-/// conditions are checked against the corresponding system depending on the
-/// signed-ness of their predicates. While the information is kept separate
-/// based on signed-ness, certain conditions can be transferred between the two
-/// systems.
-class ConstraintInfo {
-  DenseMap<Value *, unsigned> UnsignedValue2Index;
-  DenseMap<Value *, unsigned> SignedValue2Index;
-
-  ConstraintSystem UnsignedCS;
-  ConstraintSystem SignedCS;
-
-public:
-  DenseMap<Value *, unsigned> &getValue2Index(bool Signed) {
-    return Signed ? SignedValue2Index : UnsignedValue2Index;
-  }
-  const DenseMap<Value *, unsigned> &getValue2Index(bool Signed) const {
-    return Signed ? SignedValue2Index : UnsignedValue2Index;
-  }
-
-  ConstraintSystem &getCS(bool Signed) {
-    return Signed ? SignedCS : UnsignedCS;
-  }
-  const ConstraintSystem &getCS(bool Signed) const {
-    return Signed ? SignedCS : UnsignedCS;
-  }
-
-  void popLastConstraint(bool Signed) { getCS(Signed).popLastConstraint(); }
-  void popLastNVariables(bool Signed, unsigned N) {
-    getCS(Signed).popLastNVariables(N);
-  }
-};
+class ConstraintInfo;
 
 /// Struct to express a pre-condition of the form %Op0 Pred %Op1.
 struct PreconditionTy {
@@ -131,6 +99,40 @@ struct ConstraintTy {
   }
 };
 
+/// Wrapper encapsulating separate constraint systems and corresponding value
+/// mappings for both unsigned and signed information. Facts are added to and
+/// conditions are checked against the corresponding system depending on the
+/// signed-ness of their predicates. While the information is kept separate
+/// based on signed-ness, certain conditions can be transferred between the two
+/// systems.
+class ConstraintInfo {
+  DenseMap<Value *, unsigned> UnsignedValue2Index;
+  DenseMap<Value *, unsigned> SignedValue2Index;
+
+  ConstraintSystem UnsignedCS;
+  ConstraintSystem SignedCS;
+
+public:
+  DenseMap<Value *, unsigned> &getValue2Index(bool Signed) {
+    return Signed ? SignedValue2Index : UnsignedValue2Index;
+  }
+  const DenseMap<Value *, unsigned> &getValue2Index(bool Signed) const {
+    return Signed ? SignedValue2Index : UnsignedValue2Index;
+  }
+
+  ConstraintSystem &getCS(bool Signed) {
+    return Signed ? SignedCS : UnsignedCS;
+  }
+  const ConstraintSystem &getCS(bool Signed) const {
+    return Signed ? SignedCS : UnsignedCS;
+  }
+
+  void popLastConstraint(bool Signed) { getCS(Signed).popLastConstraint(); }
+  void popLastNVariables(bool Signed, unsigned N) {
+    getCS(Signed).popLastNVariables(N);
+  }
+};
+
 } // namespace
 
 // Decomposes \p V into a vector of pairs of the form { c, X } where c * X. The


        


More information about the llvm-commits mailing list