This is an archive of the discontinued LLVM Phabricator instance.

[NFC][ConstantFold] Check getAggregateElement before getSplatValue call
ClosedPublic

Authored by zsrkmyn on Aug 2 2021, 1:43 AM.

Details

Summary

Constant::getSplatValue has O(N) time complexity in the worst case,
where N is the # of elements in a vector. So we call
Constant::getAggregateElement first and return earlier if possible to
avoid unnecessary getSplatValue calls.

Diff Detail

Event Timeline

zsrkmyn created this revision.Aug 2 2021, 1:43 AM
zsrkmyn requested review of this revision.Aug 2 2021, 1:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2021, 1:43 AM
MaskRay accepted this revision.Aug 3 2021, 8:37 PM

Thanks!

This revision is now accepted and ready to land.Aug 3 2021, 8:37 PM

Would you mind helping me commit it if there's no further comments? Many thanks :-)