[llvm] llvm/lib/CodeGen/TargetSchedule.cpp:132:12: warning: Assert statement modifies 'NIter' (PR #90982)

via llvm-commits llvm-commits at lists.llvm.org
Sat May 4 09:24:18 PDT 2024


https://github.com/akshaykumars614 updated https://github.com/llvm/llvm-project/pull/90982

>From a5506b9c2ada23baeec5e4c4df00e050622664c4 Mon Sep 17 00:00:00 2001
From: akshaykumars614 <akshaykumars614 at gmail.com>
Date: Fri, 3 May 2024 12:59:03 -0400
Subject: [PATCH] [llvm] Move variable update out of assert (NFC)

closes #90328
llvm/lib/CodeGen/TargetSchedule.cpp:132:12: warning: Assert statement modifies 'NIter'
---
 llvm/lib/CodeGen/TargetSchedule.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/TargetSchedule.cpp b/llvm/lib/CodeGen/TargetSchedule.cpp
index ce59b096992d8e..b5db2a671f7d04 100644
--- a/llvm/lib/CodeGen/TargetSchedule.cpp
+++ b/llvm/lib/CodeGen/TargetSchedule.cpp
@@ -129,7 +129,8 @@ resolveSchedClass(const MachineInstr *MI) const {
   unsigned NIter = 0;
 #endif
   while (SCDesc->isVariant()) {
-    assert(++NIter < 6 && "Variants are nested deeper than the magic number");
+    ++NIter;
+    assert(NIter < 6 && "Variants are nested deeper than the magic number");
 
     SchedClass = STI->resolveSchedClass(SchedClass, MI, this);
     SCDesc = SchedModel.getSchedClassDesc(SchedClass);



More information about the llvm-commits mailing list