[all-commits] [llvm/llvm-project] 2e6004: [InstCombine] Fold zext(X) + C2 pred C -> X + C3 p...
Yingwei Zheng via All-commits
all-commits at lists.llvm.org
Thu Nov 21 04:47:46 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2e60048641e86b7a414aec51d920bc4e1e3fbeb6
https://github.com/llvm/llvm-project/commit/2e60048641e86b7a414aec51d920bc4e1e3fbeb6
Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: 2024-11-21 (Thu, 21 Nov 2024)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
M llvm/test/Transforms/InstCombine/icmp-add.ll
Log Message:
-----------
[InstCombine] Fold zext(X) + C2 pred C -> X + C3 pred C4 (#110511)
Motivating case from
https://github.com/torvalds/linux/blob/9852d85ec9d492ebef56dc5f229416c925758edc/drivers/gpu/drm/drm_edid.c#L5238-L5240:
```
define i1 @src(i8 noundef %v13) {
entry:
%conv1 = zext i8 %v13 to i32
%add = add nsw i32 %conv1, -4
%cmp = icmp ult i32 %add, 3
%cmp4 = icmp slt i8 %v13, 4
%cond = select i1 %cmp4, i1 true, i1 %cmp
ret i1 %cond
}
define i1 @tgt(i8 noundef %v13) {
entry:
%cmp4 = icmp slt i8 %v13, 7
ret i1 %cmp4
}
```
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