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
..
2025-11-18 14:33:43 +00:00
2026-01-09 17:15:31 +01:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2024-07-16 11:40:04 +02:00
2024-11-06 11:53:33 +00:00
2025-02-04 22:53:33 +01:00
2024-12-10 15:42:05 +00:00
2024-11-06 11:53:33 +00:00
2025-12-20 23:53:01 +08:00
2026-02-05 13:31:26 +00:00
2024-11-06 11:53:33 +00:00
2024-11-14 11:55:19 +01:00
2024-11-21 11:21:12 +00:00
2025-11-20 21:35:14 +00:00
2025-08-22 17:33:00 +01:00
2025-08-22 17:33:00 +01:00
2025-09-25 16:19:11 +01:00
2025-09-25 16:19:11 +01:00
2025-08-22 17:33:00 +01:00
2025-01-16 14:38:51 +00:00
2025-08-22 17:33:00 +01:00
2025-08-01 10:31:43 +01:00
2026-02-05 13:31:26 +00:00
2025-01-30 20:58:38 +00:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2024-11-15 14:19:50 +00:00
2025-05-30 11:27:18 +01:00
2024-11-06 11:53:33 +00:00
2025-10-05 16:15:51 +08:00
2025-07-19 19:37:21 -07:00
2024-11-21 12:39:53 +00:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2026-01-16 11:59:12 +00:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2025-08-10 22:55:04 +08:00
2026-02-05 13:31:26 +00:00
2025-12-02 12:43:03 +00:00
2026-01-26 14:53:09 +01:00
2025-09-07 18:32:40 +01:00
2024-11-21 11:21:12 +00:00
2025-06-11 13:27:14 +02:00
2024-11-06 11:53:33 +00:00
2025-10-20 11:20:09 +01:00
2025-05-01 14:21:59 -07:00
2025-09-24 11:35:15 +01:00
2025-04-30 15:01:00 +02:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2026-02-13 00:06:32 +08:00
2025-03-01 12:02:57 -05:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2024-07-09 14:44:48 -07:00
2025-01-29 23:14:36 +08:00
2024-11-06 11:53:33 +00:00
2024-11-19 20:10:40 +08:00
2025-05-02 07:49:27 +08:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2024-12-09 16:44:05 +01:00
2024-11-07 14:09:45 +01:00
2024-11-06 11:53:33 +00:00
2025-01-20 12:19:07 -05:00
2025-10-10 08:03:25 +00:00
2025-10-14 13:55:04 +02:00
2026-01-05 09:39:16 +01:00
2025-10-07 17:19:48 +02:00
2024-11-06 11:53:33 +00:00
2024-11-15 14:19:50 +00:00
2024-11-06 11:53:33 +00:00
2025-07-04 22:55:07 +01:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2024-10-14 14:08:12 +01:00
2024-12-17 10:58:52 +01:00
2026-01-08 09:30:11 +09:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2025-02-01 08:48:32 +01:00
2025-08-04 14:51:03 +05:30
2024-11-06 11:53:33 +00:00
2025-04-10 19:29:28 +02:00
2024-11-06 11:53:33 +00:00
2025-06-10 12:50:16 -07:00
2024-12-09 16:44:05 +01:00
2025-07-16 08:35:13 -07:00
2024-11-06 11:53:33 +00:00
2025-01-11 15:10:42 -06:00
2025-06-22 13:32:19 +08:00
2024-11-06 11:53:33 +00:00
2024-11-06 11:53:33 +00:00
2025-04-03 18:03:16 +01:00
2024-11-06 11:53:33 +00:00
2026-01-21 10:58:40 +00:00
2025-12-09 19:44:00 -08:00
2025-04-03 16:24:56 +01:00
2025-04-03 16:24:56 +01:00
2024-11-06 11:53:33 +00:00