forked from OSchip/llvm-project
AMDGPU/R600: Fix amdgpu alias analysis pass.
R600 uses higher AS number to access kernel parameters Fixes: r298846 Differential Revision: https://reviews.llvm.org/D31520 llvm-svn: 299245
This commit is contained in:
parent
a97d36fdda
commit
3c99441ef4
|
@ -38,7 +38,8 @@ void AMDGPUAAWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
|
|||
}
|
||||
|
||||
// Must match the table in getAliasResult.
|
||||
AMDGPUAAResult::ASAliasRulesTy::ASAliasRulesTy(AMDGPUAS AS_) : AS(AS_) {
|
||||
AMDGPUAAResult::ASAliasRulesTy::ASAliasRulesTy(AMDGPUAS AS_, Triple::ArchType Arch_)
|
||||
: Arch(Arch_), AS(AS_) {
|
||||
// These arrarys are indexed by address space value
|
||||
// enum elements 0 ... to 5
|
||||
static const AliasResult ASAliasRulesPrivIsZero[6][6] = {
|
||||
|
@ -80,8 +81,12 @@ AMDGPUAAResult::ASAliasRulesTy::ASAliasRulesTy(AMDGPUAS AS_) : AS(AS_) {
|
|||
|
||||
AliasResult AMDGPUAAResult::ASAliasRulesTy::getAliasResult(unsigned AS1,
|
||||
unsigned AS2) const {
|
||||
if (AS1 > AS.MAX_COMMON_ADDRESS || AS2 > AS.MAX_COMMON_ADDRESS)
|
||||
report_fatal_error("Pointer address space out of range");
|
||||
if (AS1 > AS.MAX_COMMON_ADDRESS || AS2 > AS.MAX_COMMON_ADDRESS) {
|
||||
if (Arch == Triple::amdgcn)
|
||||
report_fatal_error("Pointer address space out of range");
|
||||
return AS1 == AS2 ? MayAlias : NoAlias;
|
||||
}
|
||||
|
||||
return (*ASAliasRules)[AS1][AS2];
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class AMDGPUAAResult : public AAResultBase<AMDGPUAAResult> {
|
|||
|
||||
public:
|
||||
explicit AMDGPUAAResult(const DataLayout &DL, Triple T) : AAResultBase(),
|
||||
DL(DL), AS(AMDGPU::getAMDGPUAS(T)), ASAliasRules(AS) {}
|
||||
DL(DL), AS(AMDGPU::getAMDGPUAS(T)), ASAliasRules(AS, T.getArch()) {}
|
||||
AMDGPUAAResult(AMDGPUAAResult &&Arg)
|
||||
: AAResultBase(std::move(Arg)), DL(Arg.DL), AS(Arg.AS),
|
||||
ASAliasRules(Arg.ASAliasRules){}
|
||||
|
@ -49,9 +49,10 @@ private:
|
|||
|
||||
class ASAliasRulesTy {
|
||||
public:
|
||||
ASAliasRulesTy(AMDGPUAS AS_);
|
||||
ASAliasRulesTy(AMDGPUAS AS_, Triple::ArchType Arch_);
|
||||
AliasResult getAliasResult(unsigned AS1, unsigned AS2) const;
|
||||
private:
|
||||
Triple::ArchType Arch;
|
||||
AMDGPUAS AS;
|
||||
const AliasResult (*ASAliasRules)[6][6];
|
||||
} ASAliasRules;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; RUN: opt -mtriple=amdgcn-- -O3 -aa-eval -print-all-alias-modref-info -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -mtriple=r600-- -O3 -aa-eval -print-all-alias-modref-info -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: NoAlias: i8 addrspace(1)* %p1, i8* %p
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
; RUN: opt -mtriple=r600-- -O3 -aa-eval -print-all-alias-modref-info -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: NoAlias: i8 addrspace(7)* %p1, i8* %p
|
||||
|
||||
define amdgpu_kernel void @test(i8* %p, i8 addrspace(7)* %p1) {
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue