This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Don't scalarize vector fpround sources that don't need it.
ClosedPublic

Authored by paquette on Mar 8 2021, 11:49 AM.

Details

Summary

Similar to the workaround code in ScalarizeVecRes_UnaryOp, ScalarizeVecRes_SETCC, ScalarizeVecRes_VSELECT, etc.

If we have a case like this:

define <1 x half> @func(<1 x float> %x) {
    %tmp = fptrunc <1 x float> %x to <1 x half>
    ret <1 x half> %tmp
}

On AArch64, the <1 x float> is legal. So, this will crash if we call GetScalarizedVector on it.

Diff Detail

Event Timeline

paquette created this revision.Mar 8 2021, 11:49 AM
paquette requested review of this revision.Mar 8 2021, 11:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2021, 11:49 AM
craig.topper added inline comments.Mar 8 2021, 12:01 PM
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
328

Move the SDLoc to the top and use for the FP_ROUND too?

paquette updated this revision to Diff 329117.Mar 8 2021, 1:12 PM

Move DL out of the if and reuse it.

This revision is now accepted and ready to land.Mar 8 2021, 1:28 PM
This revision was landed with ongoing or failed builds.Mar 8 2021, 2:38 PM
This revision was automatically updated to reflect the committed changes.