Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Tests look good; precommit.
The code logic seems unnecessarily complicated with all of these commuted matches. It would probably be easier to read and shorter if you match a binop with icmp operands and capture all 4 of those operands. Then, make sure the predicates match and make sure there's a common operand from the 4 captured icmp values.
Comment Actions
LGTM with 1 more comment fix.
lib/Analysis/InstructionSimplify.cpp | ||
---|---|---|
68–83 | The comment still doesn't match the code. Might as well move this next to the match statement inside the function in case there are other folds possible here: %A = icmp eq %TV, %FV %B = icmp eq %X, %Y (and one of these is a select operand) %C = and %A, %B %D = select %C, %TV, %FV --> %FV %A = icmp ne %TV, %FV %B = icmp ne %X, %Y (and one of these is a select operand) %C = or %A, %B %D = select %C, %TV, %FV --> %TV |
The comment still doesn't match the code. Might as well move this next to the match statement inside the function in case there are other folds possible here: