This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Fix crash when lowering G_SELECT of pointer vectors.
ClosedPublic

Authored by aemerson on Sep 11 2022, 8:33 AM.

Details

Summary

The bit masking lowering only works for vectors of scalars, so for pointer element types we need to add some casting.

Diff Detail

Event Timeline

aemerson created this revision.Sep 11 2022, 8:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 11 2022, 8:33 AM
aemerson requested review of this revision.Sep 11 2022, 8:33 AM
tschuett added inline comments.Sep 11 2022, 12:00 PM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
7275

Could you hoist the buildOr out of the if-statement? Then you only need the cast if IsEltPtr.

aemerson added inline comments.Sep 11 2022, 12:29 PM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
7275

Not really, because in the !IsEltPtr case we're trying to re-use the DstReg register, while in the other branch we're creating a new value since we need to then cast it.

Sorry. I didn't notice that they are different.

foad added inline comments.Sep 12 2022, 1:04 AM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
7272–7277

Nit: when there's an "else" I prefer to put the "if (IsEltPtr)" case first to avoid an implied double negative.

aemerson added inline comments.Sep 12 2022, 1:35 AM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
7272–7277

Ok I'll change that before commit.

arsenm accepted this revision.Sep 12 2022, 4:54 AM
arsenm added inline comments.
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
7235

Can sink this into the if

This revision is now accepted and ready to land.Sep 12 2022, 4:54 AM