rL319773 was reverted due to a recursive issue causing timeouts. This happened because I failed to check whether the discovered loads could be narrowed further. In the cases of narrow loads that could not be further narrowed, an AND was being introduced and not combined away - only to be combined into another AND and so on... forever.
Details
Diff Detail
Event Timeline
So if the Load is the same size as the mask, we used insert an AND but we don't end up eliding it? That seems like a fence post error elsewhere and it may be worth checking that out.
In any case, this change looks good. LGTM. Next time reopen the old revision, and update it. That way we can see the diffs directly on phabricator.
Ok, thanks. In this case the AND does get combined with the load, but a node also needs to be fixed up and so introduces another masking AND. This AND is then later combined with another node, in the process I assume added to the worklist, and then later hits visitAND. visitAND tries to combine with a load, which it does, but it also performs the fix up again, beginning the process again. I'm going to add another test case to satisfy myself that this works.
rL320679 was reverted due to a miscompilation. I had made the false assumption that constant operands would have been narrowed. So now any OR and XOR nodes which use constant operands, which are wider than the mask, have their operand narrowed at the end of the process.
Yes, the newly added 'test9' function was taken from the reproducer. I've also added 'test10'.