This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Bail out for scalable vectors before calling getNumElements
ClosedPublic

Authored by ctetreau on Jun 10 2020, 4:00 PM.

Details

Summary

Move the bail out logic to before constructing the Result and Lane
vectors. This is both potentially faster, and avoids calling
getNumElements on a potentially scalable vector

Diff Detail

Event Timeline

ctetreau created this revision.Jun 10 2020, 4:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 10 2020, 4:00 PM
fpetrogalli added inline comments.Jun 15 2020, 10:19 AM
llvm/lib/Analysis/ConstantFolding.cpp
2697

Given that from now on the vector is supposed to have a fixed size, maybe it is also worth defining auto FixedVTy = cast<FixedVectorType>(VTy) and use FixedVTy in place of VTy all through the end of the function?

ctetreau updated this revision to Diff 270838.Jun 15 2020, 1:01 PM

address code review issues

ctetreau marked an inline comment as done.Jun 15 2020, 1:04 PM
fpetrogalli accepted this revision.Jun 16 2020, 12:32 PM

LGTM, thanks!

This revision is now accepted and ready to land.Jun 16 2020, 12:32 PM
This revision was automatically updated to reflect the committed changes.