[llvm] [SimplifyCFG] Improve reduceSwitchRange to avoid unnecessary subtractions (PR #198374)

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Fri May 22 08:04:03 PDT 2026


================
@@ -317,6 +317,109 @@ three:
   ret i32 99783
 }
 
+; Base=0 is profitable here: shifting out the common low zero bits produces a
+; dense range without subtracting the local minimum first.
----------------
zmodem wrote:

In the end, will this get lowered without the subtraction, or does that reappear in a range check like in test9 above?

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


More information about the llvm-commits mailing list