[llvm] 0044856 - Revert "llvm/lib/CodeGen/TargetSchedule.cpp:132:12: warning: Assert statement modifies 'NIter'" (#91079)

via llvm-commits llvm-commits at lists.llvm.org
Sat May 4 11:43:12 PDT 2024


Author: David Blaikie
Date: 2024-05-04T11:43:08-07:00
New Revision: 004485690e8e36610b6f9eb4ccfc7de411aa1b1b

URL: https://github.com/llvm/llvm-project/commit/004485690e8e36610b6f9eb4ccfc7de411aa1b1b
DIFF: https://github.com/llvm/llvm-project/commit/004485690e8e36610b6f9eb4ccfc7de411aa1b1b.diff

LOG: Revert "llvm/lib/CodeGen/TargetSchedule.cpp:132:12: warning: Assert statement modifies 'NIter'" (#91079)

Reverts llvm/llvm-project#90982

NIter was only declared in !NDEBUG, and only used for assertions - so it
was correct that it was incremented inside the assertion. (& in fact now
the non-asserts build fails, because the variable is incremented even
though it isn't declared)

Added: 
    

Modified: 
    llvm/lib/CodeGen/TargetSchedule.cpp

Removed: 
    


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