diff options
| author | Tom Stellard <tstellar@redhat.com> | 2018-07-06 17:16:17 +0000 |
|---|---|---|
| committer | Tom Stellard <tstellar@redhat.com> | 2018-07-06 17:16:17 +0000 |
| commit | ec4feae1b668892f9e120dcac77c70ef39b37db9 (patch) | |
| tree | 1e16a8c0482b025546b571c6e30ecc49d607e35b /llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h | |
| parent | 373d6ed7cf24e28de441cfeef4d14c4c0a20c905 (diff) | |
| download | bcm5719-llvm-ec4feae1b668892f9e120dcac77c70ef39b37db9.tar.gz bcm5719-llvm-ec4feae1b668892f9e120dcac77c70ef39b37db9.zip | |
AMDGPU: Fix UBSan error caused by r335942
Summary: Fixes PR38071.
Reviewers: arsenm, dstenb
Reviewed By: arsenm
Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D48979
llvm-svn: 336448
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h index d21301a6a9f..251ad8d2fc8 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h @@ -114,6 +114,18 @@ public: return TargetTriple.getOS() == Triple::AMDPAL; } + bool isMesa3DOS() const { + return TargetTriple.getOS() == Triple::Mesa3D; + } + + bool isMesaKernel(const Function &F) const { + return isMesa3DOS() && !AMDGPU::isShader(F.getCallingConv()); + } + + bool isAmdCodeObjectV2(const Function &F) const { + return isAmdHsaOS() || isMesaKernel(F); + } + bool has16BitInsts() const { return Has16BitInsts; } @@ -166,6 +178,12 @@ public: return isAmdHsaOS() ? 8 : 4; } + /// Returns the offset in bytes from the start of the input buffer + /// of the first explicit kernel argument. + unsigned getExplicitKernelArgOffset(const Function &F) const { + return isAmdCodeObjectV2(F) ? 0 : 36; + } + /// \returns Maximum number of work groups per compute unit supported by the /// subtarget and limited by given \p FlatWorkGroupSize. unsigned getMaxWorkGroupsPerCU(unsigned FlatWorkGroupSize) const { @@ -384,10 +402,6 @@ public: void ParseSubtargetFeatures(StringRef CPU, StringRef FS); - bool isMesa3DOS() const { - return TargetTriple.getOS() == Triple::Mesa3D; - } - Generation getGeneration() const { return (Generation)Gen; } @@ -603,19 +617,11 @@ public: return HasUnpackedD16VMem; } - bool isMesaKernel(const Function &F) const { - return isMesa3DOS() && !AMDGPU::isShader(F.getCallingConv()); - } - // Covers VS/PS/CS graphics shaders bool isMesaGfxShader(const Function &F) const { return isMesa3DOS() && AMDGPU::isShader(F.getCallingConv()); } - bool isAmdCodeObjectV2(const Function &F) const { - return isAmdHsaOS() || isMesaKernel(F); - } - bool hasMad64_32() const { return getGeneration() >= SEA_ISLANDS; } @@ -652,12 +658,6 @@ public: return D16PreservesUnusedBits; } - /// Returns the offset in bytes from the start of the input buffer - /// of the first explicit kernel argument. - unsigned getExplicitKernelArgOffset(const Function &F) const { - return isAmdCodeObjectV2(F) ? 0 : 36; - } - /// \returns Number of bytes of arguments that are passed to a shader or /// kernel in addition to the explicit ones declared for the function. unsigned getImplicitArgNumBytes(const Function &F) const { @@ -1088,10 +1088,6 @@ public: bool hasFMA() const { return FMA; } - unsigned getExplicitKernelArgOffset(const MachineFunction &MF) const { - return 36; - } - bool hasCFAluBug() const { return CFALUBug; } bool hasVertexCache() const { return HasVertexCache; } |

