[llvm] [InstCombine] Fold signed-max sub-or pattern (PR #202274)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 00:19:50 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: mygitljf

<details>
<summary>Changes</summary>

added a small InstCombine fold for a missed simplification where subtracting a value with all low bits forced on can be reduced to a sign-bit mask. I kept it conservative around overflow flags so it does not change poison behavior.
I added scalar, small integer, vector, and no-wrap coverage. 

Fixes #<!-- -->202249

---
Full diff: https://github.com/llvm/llvm-project/pull/202274.diff


2 Files Affected:

- (modified) llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp (+11) 
- (modified) llvm/test/Transforms/InstCombine/sub.ll (+52) 


``````````diff
<html><body><h1>504 Gateway Time-out</h1>
The server didn't respond in time.
</body></html>

``````````

</details>


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


More information about the llvm-commits mailing list