[llvm] r299245 - AMDGPU/R600: Fix amdgpu alias analysis pass.
Jan Vesely via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 31 12:26:23 PDT 2017
Author: jvesely
Date: Fri Mar 31 14:26:23 2017
New Revision: 299245
URL: http://llvm.org/viewvc/llvm-project?rev=299245&view=rev
Log:
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
Added:
llvm/trunk/test/CodeGen/AMDGPU/r600.amdgpu-alias-analysis.ll
Modified:
llvm/trunk/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
llvm/trunk/lib/Target/AMDGPU/AMDGPUAliasAnalysis.h
llvm/trunk/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp?rev=299245&r1=299244&r2=299245&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp Fri Mar 31 14:26:23 2017
@@ -38,7 +38,8 @@ void AMDGPUAAWrapperPass::getAnalysisUsa
}
// 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::ASAliasR
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];
}
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUAliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUAliasAnalysis.h?rev=299245&r1=299244&r2=299245&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUAliasAnalysis.h (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUAliasAnalysis.h Fri Mar 31 14:26:23 2017
@@ -30,7 +30,7 @@ class AMDGPUAAResult : public AAResultBa
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;
Modified: llvm/trunk/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll?rev=299245&r1=299244&r2=299245&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll Fri Mar 31 14:26:23 2017
@@ -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
Added: llvm/trunk/test/CodeGen/AMDGPU/r600.amdgpu-alias-analysis.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/r600.amdgpu-alias-analysis.ll?rev=299245&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/r600.amdgpu-alias-analysis.ll (added)
+++ llvm/trunk/test/CodeGen/AMDGPU/r600.amdgpu-alias-analysis.ll Fri Mar 31 14:26:23 2017
@@ -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
+}
More information about the llvm-commits
mailing list