[llvm] [DAGCombiner] Fix the "subtraction if above a constant threshold" miscompile (PR #140042)

Piotr Fusik via llvm-commits llvm-commits at lists.llvm.org
Fri May 16 02:46:25 PDT 2025


================
@@ -12140,11 +12140,16 @@ SDValue DAGCombiner::visitSELECT(SDNode *N) {
     // (select (ult x, C), x, (add x, -C)) -> (umin x, (add x, -C))
     APInt C;
     if (sd_match(Cond1, m_ConstInt(C)) && hasUMin(VT)) {
----------------
pfusik wrote:

Done.

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


More information about the llvm-commits mailing list