-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
Description
| Bugzilla Link | 39578 |
| Version | trunk |
| OS | All |
| CC | @hfinkel,@RKSimon |
Extended Description
Forking this off from bug 29009:
define void @redundant_mask(i32 %x, i32* %st1, i8* %st2) {
%and1 = and i32 %x, 7
store i32 %and1, i32* %st1
%conv = trunc i32 %x to i8
%and2 = and i8 %conv, 7
store i8 %and2, i8* %st2
ret void
}
We (GVN?) should be able to recognize that the 2nd 'and' can be removed to reduce the IR:
define void @no_redundant_mask(i32 %x, i32* %st1, i8* %st2) {
%and1 = and i32 %x, 7
store i32 %and1, i32* %st1
%conv2 = trunc i32 %and1 to i8
store i8 %conv2, i8* %st2
ret void
}
%and1 = and i32 %x, 7
store i32 %and1, i32* %p
%conv = trunc i32 %x to i8
%r = and i8 %conv, 7
=>
%and1 = and i32 %x, 7
store i32 %and1, i32* %p
%r = trunc i32 %and1 to i8