This is an archive of the discontinued LLVM Phabricator instance.

[X86] Fold nested select_cc to select (cmp*ge/le Cond0, Cond1), LHS, Y)
ClosedPublic

Authored by RKSimon on Jun 22 2021, 6:00 AM.

Details

Summary

select (cmpeq Cond0, Cond1), LHS, (select (cmpugt Cond0, Cond1), LHS, Y) --> (select (cmpuge Cond0, Cond1), LHS, Y)
etc,

We already perform this fold in DAGCombiner for MVT::i1 comparison results, but these can still appear after legalization (in x86 case to MVT::i8 results), where we need to be more careful about generating new comparison codes.

Pulled out of D101074 to help address the remaining regressions.

Diff Detail

Event Timeline

RKSimon created this revision.Jun 22 2021, 6:00 AM
RKSimon requested review of this revision.Jun 22 2021, 6:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2021, 6:00 AM
RKSimon retitled this revision from {X86] Fold nested select_cc to select (cmp*ge/le Cond0, Cond1), LHS, Y) to [X86] Fold nested select_cc to select (cmp*ge/le Cond0, Cond1), LHS, Y).Jun 22 2021, 6:15 AM
RKSimon edited the summary of this revision. (Show Details)

cheers - any more comments?

spatel accepted this revision.Jun 23 2021, 11:02 AM

LGTM

This revision is now accepted and ready to land.Jun 23 2021, 11:02 AM
This revision was landed with ongoing or failed builds.Jun 24 2021, 3:43 AM
This revision was automatically updated to reflect the committed changes.