Kunqiu Chen
85e07bad93
[InstructionSimplify] Extend simplifyICmpWithZero to handle equivalent zero RHS ( #179055 )
...
Add a new helper function `matchEquivZeroRHS()` that recognizes
comparisons with constants that are equivalent to comparisons with zero,
and transforms the predicate accordingly.
This handles the following transformations:
- icmp sgt X, -1 --> icmp sge X, 0
- icmp sle X, -1 --> icmp slt X, 0
- icmp [us]ge X, 1 --> icmp [us]gt X, 0
- icmp [us]lt X, 1 --> icmp [us]le X, 0
This enables more optimization opportunities in `simplifyICmpWithZero`,
such as folding icmp sgt X, -1 when X is known to be non-negative.
---
- IR Impact: https://github.com/dtcxzyw/llvm-opt-benchmark/pull/3414
2026-02-13 00:06:32 +08:00
..
2026-01-04 09:24:53 +08:00
2025-10-07 10:45:49 -04:00
2025-10-20 08:50:09 +00:00
2026-01-21 10:40:10 -05:00
2025-10-07 10:45:49 -04:00
2025-10-07 10:45:49 -04:00
2025-12-09 12:42:41 +08:00
2026-02-03 19:14:27 +01:00
2025-03-14 15:50:49 +00:00
2026-01-14 10:40:31 -05:00
2025-03-14 15:50:49 +00:00
2026-02-11 17:59:42 +00:00
2026-01-14 10:40:31 -05:00
2025-11-04 09:20:01 -08:00
2026-01-04 09:24:53 +08:00
2025-11-04 12:49:33 -05:00
2026-01-04 09:24:53 +08:00
2026-01-14 14:59:18 +00:00
2025-10-02 16:07:55 +00:00
2025-05-28 10:07:02 +01:00
2025-11-15 10:01:04 -08:00
2025-06-17 11:22:23 -07:00
2025-05-23 15:46:34 +01:00
2025-05-28 10:07:02 +01:00
2025-05-28 13:02:03 +01:00
2025-09-20 19:24:19 +01:00
2025-06-10 11:46:06 -07:00
2025-10-02 16:07:55 +00:00
2025-10-02 16:07:55 +00:00
2025-08-20 13:44:56 +00:00
2026-02-02 09:32:57 -08:00
2026-01-04 09:24:53 +08:00
2025-12-03 16:16:22 +00:00
2025-12-12 10:45:41 -08:00
2026-01-14 10:40:31 -05:00
2025-10-23 20:31:31 +08:00
2025-10-31 11:01:42 -04:00
2025-10-07 10:45:49 -04:00
2025-10-07 10:45:49 -04:00
2025-10-07 10:45:49 -04:00
2025-10-07 10:45:49 -04:00
2025-10-07 10:45:49 -04:00
2025-10-31 11:01:42 -04:00
2025-12-03 16:16:22 +00:00
2026-02-13 00:06:32 +08:00
2025-10-31 11:01:42 -04:00
2025-10-07 10:45:49 -04:00
2025-10-07 10:45:49 -04:00
2025-11-27 15:03:36 +00:00
2025-10-07 10:45:49 -04:00
2025-10-07 10:45:49 -04:00
2026-01-04 09:24:53 +08:00
2025-10-07 10:45:49 -04:00
2025-06-06 12:56:28 +08:00
2025-07-31 15:56:31 -04:00
2026-01-14 10:40:31 -05:00
2026-01-04 09:24:53 +08:00
2025-12-03 16:16:22 +00:00
2025-10-31 11:01:42 -04:00
2026-01-14 10:40:31 -05:00
2026-02-02 11:11:41 -05:00
2025-11-03 10:19:12 -05:00