[llvm] [ConstraintElim] decompose subtract with guard as precondition (PR #209615)

Mikael Holmen via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 00:27:55 PDT 2026


mikaelholmen wrote:

> > I noticed that this patch makes constraint-elimination significantly slower on some input. An example:
> > [...]

I saw that
```opt -passes="constraint-elimination" bbi-120619.ll -o /dev/null```
terminates very quickly again with
```
commit eefe7721b114a71c94c966b1792ebd3b2fb8544e
Author: Florian Hahn <flo at fhahn.com>
Date:   Fri Sep 18 22:32:33 2026 +0100

    [ConstraintElim] Add signed no-wrap rule for sub to isKnownNoWrap. (#224621)
    
    Port the existing logic from usub_sat simplification to isKnownNoWrap:
    Op0 - Op1 does not wrap signed if Op1 is non-negative and Op0 s>= Op1.
    
    https://alive2.llvm.org/ce/z/HsUyo_
    
    This is in preparation to update simplifications to also use
    isKnownNoWrap.
    
    Improves results in a few cases
    https://github.com/dtcxzyw/llvm-opt-benchmark-nightly/pull/1358.
    
    Compile-time impact is in the noise:
    
    https://llvm-compile-time-tracker.com/compare.php?from=0401d338f425ab4d85738d48e9f5432685bf70fb&to=5f9d1cae5fe4222b9ddaf59605e12420df09808e&stat=instructions:u
    
    PR: https://github.com/llvm/llvm-project/pull/224621
```

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


More information about the llvm-commits mailing list