[llvm] [ConstraintElim] Add (UGE, var, 0) to unsigned system for new vars. (PR #76262)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 23 01:58:23 PST 2023


================
@@ -273,7 +273,15 @@ class ConstraintInfo {
 
 public:
   ConstraintInfo(const DataLayout &DL, ArrayRef<Value *> FunctionArgs)
-      : UnsignedCS(FunctionArgs), SignedCS(FunctionArgs), DL(DL) {}
+      : UnsignedCS(FunctionArgs), SignedCS(FunctionArgs), DL(DL) {
+    auto &Value2Index = getValue2Index(false);
+    for (Value *V : FunctionArgs) {
+      ConstraintTy VarPos(SmallVector<int64_t, 8>(Value2Index.size() + 1, 0),
+                          false, false, false);
+      VarPos.Coefficients[Value2Index[V]] = -1;
----------------
nikic wrote:

This is unrelated to the patch, but why are we representing constraints as a simple coefficient vector, rather than using the same coefficient + index representation that ConstraintSystem itself uses? This seems quite inefficient as the number of variables grows large.

https://github.com/llvm/llvm-project/pull/76262


More information about the llvm-commits mailing list