We can be in situations where And 1 zext nodes will not have been yet, preventing us from detecting removable cmpz/csinc patterns. This peeks through those nodes allowing us to simplify more code.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/ARM/ARMISelLowering.cpp | ||
---|---|---|
14640 | The problem with these end-to-end test that we have for this code is that we are not testing things in isolation here, and that the patterns are difficult to see.... perhaps I am missing context or something else, but can you clarify with a "zext and" nodes is? I am just failing to see what the AND 1 is doing here. |
llvm/lib/Target/ARM/ARMISelLowering.cpp | ||
---|---|---|
14640 | By "zext and" I just meant the And that are produces by legalizing an i1 zext. So from a zext i1 %x to i32, we legalize the %x to an i32 and add an and %x, 1 to make sure the value is correct. The operator we test for in this function can only produce 0 or 1, so it doesn't matter much if we And that with 1, we will remain at the same value. Those extra And 1's will be removed later, because we know they don't do anything. By that point we may not re-visit this node to do this transform, though. Hence the improvement in some of the tests. |
llvm/lib/Target/ARM/ARMISelLowering.cpp | ||
---|---|---|
14640 | Ahhhh okay, thanks, got it! LGTM. Perhaps useful to that add that as a comment here (the and %x, 1 is for the legalized zext i1 %x to i32 ). |
The problem with these end-to-end test that we have for this code is that we are not testing things in isolation here, and that the patterns are difficult to see.... perhaps I am missing context or something else, but can you clarify with a "zext and" nodes is? I am just failing to see what the AND 1 is doing here.