This is an archive of the discontinued LLVM Phabricator instance.

Fix SGPR + VGPR + offset Scratch offset folding
ClosedPublic

Authored by Petar.Avramovic on Feb 28 2023, 4:44 AM.

Details

Reviewers
foad
dstuttard
Group Reviewers
Restricted Project
Commits
rGded69779be05: Fix SGPR + VGPR + offset Scratch offset folding
Summary

Values in SGPR and VGPR register are treated as unsigned by hardware.

When value in 32-bit SGPR or VGPR base can be negative calculate offset
using 32-bit add instructions, otherwise use
sgpr(unsigned) + vgpr(unsigned) + offset.
Does not affect case where whole offset comes from SGPR + VGPR register
(immediate offset is 0).

LoopStrengthReduce.cpp changes offsets to negative and in some
iterations value in SGPR or VGPR register could be negative.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptFeb 28 2023, 4:44 AM
Petar.Avramovic requested review of this revision.Feb 28 2023, 4:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 28 2023, 4:44 AM
foad added inline comments.Mar 8 2023, 6:47 AM
llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
1862

I think this case also needs a check?

add check on other place and add same check for globalisel

foad accepted this revision.Mar 8 2023, 8:58 AM
This revision is now accepted and ready to land.Mar 8 2023, 8:58 AM
This revision was landed with ongoing or failed builds.Mar 9 2023, 1:55 AM
This revision was automatically updated to reflect the committed changes.