[PATCH] D142647: [ConstraintElimination] Move Value2Index map to ConstraintSystem (NFC)
Zain Jaffal via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 26 09:28:04 PST 2023
zjaffal created this revision.
zjaffal added reviewers: nikic, fhahn, spatel.
Herald added subscribers: StephenFan, arphaman, hiraditya.
Herald added a project: All.
zjaffal requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142647
Files:
llvm/include/llvm/Analysis/ConstraintSystem.h
llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
Index: llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
+++ llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
@@ -123,8 +123,6 @@
/// 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;
@@ -135,10 +133,10 @@
ConstraintInfo(const DataLayout &DL) : DL(DL) {}
DenseMap<Value *, unsigned> &getValue2Index(bool Signed) {
- return Signed ? SignedValue2Index : UnsignedValue2Index;
+ return Signed ? SignedCS.getValue2Index() : UnsignedCS.getValue2Index();
}
const DenseMap<Value *, unsigned> &getValue2Index(bool Signed) const {
- return Signed ? SignedValue2Index : UnsignedValue2Index;
+ return Signed ? SignedCS.getValue2Index() : UnsignedCS.getValue2Index();
}
ConstraintSystem &getCS(bool Signed) {
Index: llvm/include/llvm/Analysis/ConstraintSystem.h
===================================================================
--- llvm/include/llvm/Analysis/ConstraintSystem.h
+++ llvm/include/llvm/Analysis/ConstraintSystem.h
@@ -11,7 +11,9 @@
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/IR/Value.h"
#include <string>
@@ -22,7 +24,7 @@
/// 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;
-
+ DenseMap<Value *, unsigned> Value2Index;
/// Current greatest common divisor for all coefficients in the system.
uint32_t GCD = 1;
@@ -52,6 +54,10 @@
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142647.492486.patch
Type: text/x-patch
Size: 2223 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230126/1087beb8/attachment.bin>
More information about the llvm-commits
mailing list