-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Closed
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization
Description
https://godbolt.org/z/aa5778bEf
define i8 @add-shl-sdiv-scalar0(i8 %x) {
%sd = sdiv i8 %x, -4
%sl = shl i8 %sd, 2
%rz = add i8 %sl, %x
ret i8 %rz
}
define i8 @add-shl-sdiv-scalar1(i8 %x) {
%sd = sdiv i8 %x, -4
%sl = shl i8 %sd, 2
%rz = add i8 %x, %sl
ret i8 %rz
}
Output:
define i8 @add-shl-sdiv-scalar0(i8 %x) {
%rz = srem i8 %x, 4
ret i8 %rz
}
define i8 @add-shl-sdiv-scalar1(i8 %x) {
%sd = sdiv i8 %x, -4
%sl = shl i8 %sd, 2
%rz = add i8 %x, %sl
ret i8 %rz
}
Metadata
Metadata
Assignees
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization