OSDN Git Service

[AMDGPU] Avoid splitting FLAT offsets in unsafe ways
authorJay Foad <jay.foad@amd.com>
Wed, 8 Jul 2020 13:13:32 +0000 (14:13 +0100)
committerJay Foad <jay.foad@amd.com>
Fri, 17 Jul 2020 10:44:10 +0000 (11:44 +0100)
commit760af7a0743278b6dd7782b177f4d6d086c726e0
treeb0de8ca998f50d276a548d0fbbd3693536902668
parent1cfb207737cc347baeb55999bd2cbd46fb5d9309
[AMDGPU] Avoid splitting FLAT offsets in unsafe ways

As explained in the comment:

// For a FLAT instruction the hardware decides whether to access
// global/scratch/shared memory based on the high bits of vaddr,
// ignoring the offset field, so we have to ensure that when we add
// remainder to vaddr it still points into the same underlying object.
// The easiest way to do that is to make sure that we split the offset
// into two pieces that are both >= 0 or both <= 0.

In particular FLAT (as opposed to SCRATCH and GLOBAL) instructions have
an unsigned immediate offset field, so we can't use it to help split a
negative offset.

Differential Revision: https://reviews.llvm.org/D83394
llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
llvm/test/CodeGen/AMDGPU/flat-address-space.ll
llvm/test/CodeGen/AMDGPU/offset-split-flat.ll
llvm/test/CodeGen/AMDGPU/offset-split-global.ll
llvm/test/CodeGen/AMDGPU/promote-constOffset-to-imm.ll
llvm/test/CodeGen/AMDGPU/store-hi16.ll