-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
good first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contributellvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization
Description
Pulled out #76524 - we fail to recognize that extension is unnecessary and that the trunc is nsw
define i8 @src(i16 noundef %x) {
entry:
%conv = sext i16 noundef %x to i128
%add = add i128 %conv, 128
%or.cond.i = icmp ult i128 %add, 256
assume i1 %or.cond.i
%conv1 = trunc i16 noundef %x to i8
ret i8 %conv1
}
=>
define i8 @tgt(i16 noundef %x) {
entry:
%add = add i16 noundef %x, 128
%or.cond.i = icmp ult i16 %add, 256
assume i1 %or.cond.i
%conv1 = trunc nsw i16 noundef %x to i8
ret i8 %conv1
}
Transformation seems to be correct!Metadata
Metadata
Assignees
Labels
good first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contributellvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization