[PATCH] D84544: [ConstraintSystem] Add helpers to deal with linear constraints.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 09:54:07 PDT 2020


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/include/llvm/Analysis/ConstraintSystem.h:38
+
+  /// Retuns true if there may be a solution for the constraints in the system.
+  bool mayHaveSolutionImpl();
----------------
typo - Returns


================
Comment at: llvm/include/llvm/Analysis/ConstraintSystem.h:52
+
+  /// Retuns true if there may be a solution for the constraints in the system.
+  bool mayHaveSolution();
----------------
typo - Returns


================
Comment at: llvm/lib/Analysis/ConstraintSystem.cpp:35
+  // FIXME do not use copy
+  for (unsigned R1 = 0; R1 < Constraints.size(); R1++) {
+    if (Constraints[R1][1] == 0) {
----------------
The incoming Constraints are not changing in this loop? Put size() into a loop local variable: 
https://llvm.org/docs/CodingStandards.html#don-t-evaluate-end-every-time-through-a-loop


================
Comment at: llvm/lib/Analysis/ConstraintSystem.cpp:39
+      NR.push_back(Constraints[R1][0]);
+      for (unsigned i = 2; i < Constraints[0].size(); i++) {
+        NR.push_back(Constraints[R1][i]);
----------------
NumVariables instead of Constraints[0].size()?


================
Comment at: llvm/lib/Analysis/ConstraintSystem.cpp:48
+    bool EliminatedInRow = false;
+    for (unsigned R2 = R1 + 1; R2 < Constraints.size(); R2++) {
+      if (R1 == R2)
----------------
The incoming Constraints are not changing in this loop? Put size() into a loop local variable:
https://llvm.org/docs/CodingStandards.html#don-t-evaluate-end-every-time-through-a-loop


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84544/new/

https://reviews.llvm.org/D84544



More information about the llvm-commits mailing list