This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Don't lower consecutive select instructions with different kind if target don't support it
Needs ReviewPublic

Authored by D.Kharlamov on Oct 26 2021, 10:22 AM.

Details

Summary

Some targets(f.e. ARM) can't lower some SelectKind's . Don't expand/not expand consecutive selects if some of it has different legality.

Diff Detail

Event Timeline

D.Kharlamov created this revision.Oct 26 2021, 10:22 AM
D.Kharlamov requested review of this revision.Oct 26 2021, 10:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 26 2021, 10:22 AM
D.Kharlamov edited the summary of this revision. (Show Details)Oct 26 2021, 10:36 AM

Hello. I think this makes sense, but is it targeted at Arm or for some other backend? At least under MVE we don't really not support ScalarCondVectorVal selects, even if they can be a bit inefficient (less branches but more vector code).

Hello. It's for private target. It has same TargetLowering::isSelectSupported() as in ARM target. This patch removes inconsistency when selects are not lowered by CodegenPrepare.

OK. That makes sense. It was just that the test case here we made work already in the backend :) It's not really an unsupported case. It looks like it makes a good testcase though.

llvm/lib/CodeGen/CodeGenPrepare.cpp
6721

Perhaps change "have the same kind" to "are equally supported"?