[llvm] 69affe7 - [llvm][Analysis] Silence warning when building with MSVC

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 21 08:06:04 PDT 2025


Author: Alexandre Ganea
Date: 2025-09-21T11:05:29-04:00
New Revision: 69affe790e50eb3b8637b123f105000995bf39a8

URL: https://github.com/llvm/llvm-project/commit/69affe790e50eb3b8637b123f105000995bf39a8
DIFF: https://github.com/llvm/llvm-project/commit/69affe790e50eb3b8637b123f105000995bf39a8.diff

LOG: [llvm][Analysis] Silence warning when building with MSVC

When building an assert-enabled target, silence the following:
```
C:\git\llvm-project\llvm\include\llvm/Analysis/DependenceAnalysis.h(290): warning C4018: '<=': signed/unsigned mismatch
```

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/DependenceAnalysis.h
    llvm/lib/Analysis/DependenceAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/DependenceAnalysis.h b/llvm/include/llvm/Analysis/DependenceAnalysis.h
index a755b8eb39888..a2ca695d5f750 100644
--- a/llvm/include/llvm/Analysis/DependenceAnalysis.h
+++ b/llvm/include/llvm/Analysis/DependenceAnalysis.h
@@ -287,7 +287,8 @@ class LLVM_ABI FullDependence final : public Dependence {
       assert(0 < Level && Level <= Levels && "Level out of range");
       return DV[Level - 1];
     } else {
-      assert(Levels < Level && Level <= Levels + SameSDLevels &&
+      assert(Levels < Level &&
+             Level <= static_cast<unsigned>(Levels) + SameSDLevels &&
              "isSameSD level out of range");
       return DVSameSD[Level - Levels - 1];
     }

diff  --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp
index b95bba2c02092..1f0da8d1830d3 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -389,7 +389,8 @@ bool FullDependence::isSplitable(unsigned Level, bool isSameSD) const {
 // performed across two separate loop nests that have the Same iteration space
 // and Depth.
 bool FullDependence::inSameSDLoops(unsigned Level) const {
-  assert(0 < Level && Level <= Levels + SameSDLevels && "Level out of range");
+  assert(0 < Level && Level <= static_cast<unsigned>(Levels) + SameSDLevels &&
+         "Level out of range");
   return Level > Levels;
 }
 


        


More information about the llvm-commits mailing list