Yingwei Zheng
c89d731c5d
[LVI] Infer non-zero from equality icmp (#112838)
This following pattern is common in loop headers:
```
%101 = sub nuw i64 %78, %98
%103 = icmp eq i64 %78, %98
br i1 %103, label %.thread.i.i, label %.preheader.preheader.i.i
.preheader.preheader.i.i:
%invariant.umin.i.i = call i64 @llvm.umin.i64(i64 %101, i64 9)
%umax.i = call i64 @llvm.umax.i64(i64 %invariant.umin.i.i, i64 1)
br label %.preheader.i.i
.preheader.i.i:
...
%116 = add nuw nsw i64 %.011.i.i, 1
%exitcond.not.i = icmp eq i64 %116, %umax.i
br i1 %exitcond.not.i, label %.critedge.i.i, label %.preheader.i.i
```
As `%78` is not equal to `%98` in BB `.preheader.preheader.i.i`, we can
prove `%101` is non-zero. Then we can simplify the loop exit condition.
Addresses regression introduced by
https://github.com/llvm/llvm-project/pull/112742.
2024-10-18 21:19:02 +08:00
..
2024-06-04 08:31:03 +02:00
2024-09-20 14:29:19 +02:00
2024-09-20 14:29:19 +02:00
2024-09-20 14:29:19 +02:00
2024-04-13 15:07:55 +08:00
2024-09-20 14:29:19 +02:00
2024-07-03 12:41:49 +02:00
2024-02-23 02:42:49 +08:00
2024-02-05 11:57:34 +01:00
2024-07-25 21:29:18 +08:00
2024-01-18 16:57:29 +01:00
2023-12-12 11:54:33 +01:00
2024-04-13 15:07:55 +08:00
2024-04-04 14:48:11 +08:00
2023-12-22 09:26:32 +01:00
2024-09-20 14:29:19 +02:00
2024-08-07 02:00:33 +08:00
2024-05-07 14:57:29 -05:00
2024-02-05 11:57:34 +01:00
2024-06-20 13:45:18 +08:00
2024-03-07 12:02:09 -08:00
2024-05-07 14:57:29 -05:00
2024-10-18 21:19:02 +08:00
2024-03-07 14:37:10 -08:00
2023-12-12 12:06:19 +01:00
2024-07-02 12:18:52 +02:00
2024-09-20 14:29:19 +02:00