This is an archive of the discontinued LLVM Phabricator instance.

[DAG] PromoteIntRes_BUILD_VECTOR - extend constant boolean vectors according to target BooleanContents
ClosedPublic

Authored by RKSimon on Jul 13 2022, 7:13 AM.

Details

Summary

PromoteIntRes_BUILD_VECTOR currently always ANY_EXTENDs build vector operands, but if this is a constant boolean vector we're losing the useful ability to keep the vector matching the BooleanContents mode used by the target.

This patch extends constant boolean vectors according to target BooleanContents, allowing a number of additional all-bits folds (notable XOR -> NOT conversions) to occur.

Diff Detail

Event Timeline

RKSimon created this revision.Jul 13 2022, 7:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 7:13 AM
RKSimon requested review of this revision.Jul 13 2022, 7:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 7:13 AM
RKSimon added inline comments.Jul 13 2022, 7:17 AM
llvm/test/CodeGen/PowerPC/vec-select.ll
56

@nemanjai Please can you confirm if you intended to avoid the XXSEL pattern because <i1 -1, i1 -1, i1 -1, i1 -1> would extend to <i32 1, i32 1, i32 1, i32 1> or some other reason?

RKSimon planned changes to this revision.Jul 13 2022, 9:19 AM
RKSimon updated this revision to Diff 444313.Jul 13 2022, 9:44 AM
RKSimon edited the summary of this revision. (Show Details)
RKSimon added a subscriber: shchenz.
RKSimon added inline comments.
llvm/test/CodeGen/PowerPC/vec-select.ll
56

@shchenz I'm not sure if @nemanjai is around, do you happen to know any background to this please?

shchenz added inline comments.Jul 18 2022, 6:52 AM
llvm/test/CodeGen/PowerPC/vec-select.ll
56

To me, this looks like improvement for 4 x i1 type. We cannot guarantee the higher 31 bits even before this patch.

efriedma added inline comments.Jul 18 2022, 11:08 AM
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
5315

Please fix this comment to make it clear this is a heuristic; there isn't any semantic requirement that the high bits match getBooleanContents() here.

RKSimon updated this revision to Diff 445608.Jul 18 2022, 12:58 PM

Adjust comment to make it clear that the extension isn't necessary, just useful for further folds.

RKSimon marked an inline comment as done.Jul 18 2022, 12:58 PM

any more comments?

This revision is now accepted and ready to land.Jul 19 2022, 11:48 AM
This revision was landed with ongoing or failed builds.Jul 20 2022, 2:49 AM
This revision was automatically updated to reflect the committed changes.