[llvm] [TableGen] Avoid assignmentInAssert warning (PR #139715)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue May 13 07:10:37 PDT 2025


================
@@ -2608,9 +2608,9 @@ void GICombinerEmitter::emitTestSimplePredicate(raw_ostream &OS) {
     // That way we can just get the RuleID from the enum by subtracting
     // (GICXXPred_Invalid + 1).
     unsigned ExpectedID = 0;
-    (void)ExpectedID;
     for (const auto &ID : keys(AllCombineRules)) {
-      assert(ExpectedID++ == ID && "combine rules are not ordered!");
+      ++ExpectedID;
+      assert(ExpectedID == ID && "combine rules are not ordered!");
----------------
jayfoad wrote:

The original code used post-increment, so these two lines should be swapped.

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


More information about the llvm-commits mailing list