This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/GlobalISel: Fix assert on invalid cond code for llvm.amdgcn.icmp
ClosedPublic

Authored by arsenm on Jan 18 2022, 3:39 PM.

Diff Detail

Event Timeline

arsenm created this revision.Jan 18 2022, 3:39 PM
arsenm requested review of this revision.Jan 18 2022, 3:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2022, 3:39 PM
Herald added a subscriber: wdng. · View Herald Transcript
foad added inline comments.Jan 19 2022, 12:15 AM
llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
1108

Why not just return false? Is failing to select not good enough?

arsenm added inline comments.Jan 19 2022, 5:25 AM
llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
1108

This reproduces the current behavior. A few lit tests also happen to use this to sneak an undef past the IR passes

foad accepted this revision.Jan 27 2022, 2:30 AM

This reproduces the current behavior.

You mean SelectionDAG behaviour? I'm not a huge fan of reproducing weird corner case behaviour, but I guess this is OK.

llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
1120

Can you either put the new code here, or assert that getV_CMPOpcode succeeded here?

This revision is now accepted and ready to land.Jan 27 2022, 2:30 AM
arsenm added inline comments.Jan 27 2022, 7:44 AM
llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
1120

getV_CMPOpcode can still fail based on the type (although I guess illegal i16 compares should have failed the verifier already)