[llvm] [SimplifyCFG] handle monotonic wrapped case for D150943 (PR #65882)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 11 19:44:41 PDT 2023


================
@@ -6061,8 +6061,9 @@ SwitchLookupTable::SwitchLookupTable(
     bool LinearMappingPossible = true;
     APInt PrevVal;
     APInt DistToPrev;
-    // When linear map is monotonic, we can attach nsw.
-    bool Wrapped = false;
+    // When linear map is monotonic and signed overflow doesn't happen on
+    // maximum index, we can attach nsw on Add and Mul.
+    bool NMon = false;
----------------
nikic wrote:

NMon -> NonMonotonic would be slightly clearer imho.

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


More information about the llvm-commits mailing list