[all-commits] [llvm/llvm-project] 76d614: [InstSimplify] Extend icmp-of-add simplification t...
Pedro Lobo via All-commits
all-commits at lists.llvm.org
Thu Nov 20 13:35:36 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 76d614b7c1222f459d42c6cfdf619da19ac3f739
https://github.com/llvm/llvm-project/commit/76d614b7c1222f459d42c6cfdf619da19ac3f739
Author: Pedro Lobo <pedro.lobo at tecnico.ulisboa.pt>
Date: 2025-11-20 (Thu, 20 Nov 2025)
Changed paths:
M llvm/lib/Analysis/InstructionSimplify.cpp
M llvm/test/Transforms/InstSimplify/compare.ll
Log Message:
-----------
[InstSimplify] Extend icmp-of-add simplification to sle/sgt/sge (#168900)
When comparing additions with the same base where one has `nsw`, the
following simplification can be performed:
```llvm
icmp slt/sgt/sle/sge (x + C1), (x +nsw C2)
=>
icmp slt/sgt/sle/sge C1, C2
```
Previously this was only done for `slt`. This patch extends it to the
`sgt`, `sle`, and `sge` predicates when either of the conditions hold:
- `C1 <= C2 && C1 >= 0`, or
- `C2 <= C1 && C1 <= 0`
This patch also handles the `C1 == C2` case, which was previously
excluded.
Proof: https://alive2.llvm.org/ce/z/LtmY4f
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list