This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/GlobalISel: Refine SMRD selection rules
ClosedPublic

Authored by arsenm on Dec 27 2019, 7:52 AM.

Details

Summary

Fix selecting these for volatile global loads, and ensure the loads
are constant enough.

Diff Detail

Event Timeline

arsenm created this revision.Dec 27 2019, 7:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 27 2019, 7:52 AM
rampitec added inline comments.Jan 2 2020, 10:49 AM
llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
414

'(MMO->getSize() % 4) == 0'? What if we need 6 bytes, like v3i16?

arsenm updated this revision to Diff 235927.Jan 2 2020, 12:40 PM

Add test

arsenm marked an inline comment as done.Jan 2 2020, 12:41 PM
arsenm added inline comments.
llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
414

If it was legal, the alignment is high enough

rampitec added inline comments.Jan 2 2020, 12:48 PM
llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
414

Not necessarily, a vload() may result in underaligned loads. Also we cannot really load a subdword even if aligned, we would need to zero/sign extend it manually.

arsenm marked an inline comment as done.Jan 2 2020, 12:57 PM
arsenm added inline comments.
llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
414

The legalizer has already run by this point and would have broken down totally illegal loads. If it is sufficiently aligned, extra bits can be loaded. The high bits do not need to be considered here. The G_ZEXTLOAD/G_SEXTLOAD are not legal, so cases where the high bits matter will not reach here

rampitec accepted this revision.Jan 2 2020, 1:02 PM

LGTM

This revision is now accepted and ready to land.Jan 2 2020, 1:02 PM