[llvm] [InstCombine] Fold icmp with clamp into unsigned bound check (PR #161303)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 30 09:16:06 PDT 2025


================
@@ -5780,6 +5780,47 @@ Instruction *InstCombinerImpl::foldICmpWithMinMax(Instruction &I,
   return nullptr;
 }
 
+// Transform patterns like:
+//   icmp eq/ne X, min(max(X, Lo), Hi)
+// Into:
+//   (X - Lo) u< (Hi - Lo + 1)
----------------
dtcxzyw wrote:

Use `///` for header comments.

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


More information about the llvm-commits mailing list