[llvm] 665ee0c - Revert "[ConstraintElimination] Move Value2Index map to ConstraintSystem (NFC)"

Zain Jaffal via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 03:30:13 PST 2023


Author: Zain Jaffal
Date: 2023-02-08T11:29:59Z
New Revision: 665ee0cd57f92a112cf8e929d00768e282fb205a

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

LOG: Revert "[ConstraintElimination] Move Value2Index map to ConstraintSystem (NFC)"

This reverts commit 40ffe9c167395256b43846733ab69eec17eead78.

Reverted because some comments where missed in the review https://reviews.llvm.org/D142647

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/ConstraintSystem.h
    llvm/lib/Transforms/Scalar/ConstraintElimination.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/ConstraintSystem.h b/llvm/include/llvm/Analysis/ConstraintSystem.h
index 6b2553438bdfb..719fe339cf788 100644
--- a/llvm/include/llvm/Analysis/ConstraintSystem.h
+++ b/llvm/include/llvm/Analysis/ConstraintSystem.h
@@ -11,23 +11,18 @@
 
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 
 #include <string>
 
 namespace llvm {
-class Value;
+
 class ConstraintSystem {
   /// Current linear constraints in the system.
   /// An entry of the form c0, c1, ... cn represents the following constraint:
   ///   c0 >= v0 * c1 + .... + v{n-1} * cn
   SmallVector<SmallVector<int64_t, 8>, 4> Constraints;
 
-  /// a Map between variabled collected in ConstraintElimination and their
-  /// corresponding index in the constraint system solver.
-  DenseMap<Value *, unsigned> Value2Index;
-
   /// Current greatest common divisor for all coefficients in the system.
   uint32_t GCD = 1;
 
@@ -57,11 +52,6 @@ class ConstraintSystem {
     return true;
   }
 
-  DenseMap<Value *, unsigned> &getValue2Index() { return Value2Index; }
-  const DenseMap<Value *, unsigned> &getValue2Index() const {
-    return Value2Index;
-  }
-
   bool addVariableRowFill(ArrayRef<int64_t> R) {
     // If all variable coefficients are 0, the constraint does not provide any
     // usable information.

diff  --git a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
index f1bb73a63dee0..12fcb6aa98465 100644
--- a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
@@ -123,6 +123,8 @@ struct ConstraintTy {
 /// 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;
@@ -133,10 +135,10 @@ class ConstraintInfo {
   ConstraintInfo(const DataLayout &DL) : DL(DL) {}
 
   DenseMap<Value *, unsigned> &getValue2Index(bool Signed) {
-    return Signed ? SignedCS.getValue2Index() : UnsignedCS.getValue2Index();
+    return Signed ? SignedValue2Index : UnsignedValue2Index;
   }
   const DenseMap<Value *, unsigned> &getValue2Index(bool Signed) const {
-    return Signed ? SignedCS.getValue2Index() : UnsignedCS.getValue2Index();
+    return Signed ? SignedValue2Index : UnsignedValue2Index;
   }
 
   ConstraintSystem &getCS(bool Signed) {


        


More information about the llvm-commits mailing list