This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] [NFC] Remove dead code in BUILD_VECTOR peephole
ClosedPublic

Authored by qiucf on Dec 29 2020, 11:47 PM.

Details

Summary

The piece of code tries to use splat+shift to lower build_vector with repeating bit pattern. And immediate field of vector splat is only 5 bits (-16~15). It iterates over them one by one to find which shifts/rotates to number in build_vector.

This patch removes code to try matching constant with algebraic right-shift because that's meaningless - any negative number's algebraic right-shift won't produce result smaller than itself. Also, (int)((unsigned)i >> j) means logical shift-right in C.

Diff Detail

Event Timeline

qiucf created this revision.Dec 29 2020, 11:47 PM
qiucf requested review of this revision.Dec 29 2020, 11:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 29 2020, 11:47 PM
RKSimon accepted this revision.Dec 30 2020, 2:48 AM

LGTM - cheers.

llvm/lib/Target/PowerPC/PPCISelLowering.cpp
9583

Have you been able to look at these at all? PR47942 mentions that we have no code coverage for the vsldoi 2/3 cases

This revision is now accepted and ready to land.Dec 30 2020, 2:48 AM
qiucf marked an inline comment as done.Jan 4 2021, 7:30 PM
qiucf added inline comments.
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
9583

Committed rG48340fbe to cover the two cases.

This revision was automatically updated to reflect the committed changes.
qiucf marked an inline comment as done.