-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Description
| Bugzilla Link | 44521 |
| Version | trunk |
| OS | All |
| CC | @LebedevRI,@rotateright |
Extended Description
The following stay invariant under -instcombine:
define i8 @sign_select_scalar_sgt(i8 %cond, i8 %tval, i8 %fval) {
%cmp = icmp sgt i8 %cond, -1
%res = select i1 %cmp, i8 %fval, i8 %tval
ret i8 %res
}
define i8 @sign_select_scalar_slt(i8 %cond, i8 %tval, i8 %fval) {
%cmp = icmp slt i8 %cond, 0
%res = select i1 %cmp, i8 %tval, i8 %fval
ret i8 %res
}
define <4 x i8> @sign_select_vec_sgt(<4 x i8> %cond, <4 x i8> %tval, <4 x i8> %fval) {
%cmp = icmp sgt <4 x i8> %cond, <i8 -1, i8 -1, i8 -1, i8 -1>
%res = select <4 x i1> %cmp, <4 x i8> %fval, <4 x i8> %tval
ret <4 x i8> %res
}
define <4 x i8> @sign_select_vec_slt(<4 x i8> %cond, <4 x i8> %tval, <4 x i8> %fval) {
%cmp = icmp slt <4 x i8> %cond, zeroinitializer
%res = select <4 x i1> %cmp, <4 x i8> %tval, <4 x i8> %fval
ret <4 x i8> %res
}
I would expect that this gets canonicalized one way or another (<0 probably).
Noticed this when some InstCombine worklist order changes resulted in the above patterns getting flipped in places.