[llvm] r298721 - [AMDGPU] Add AMDGPUAliasAnalysis to opt pipeline
Stanislav Mekhanoshin via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 24 11:01:15 PDT 2017
Author: rampitec
Date: Fri Mar 24 13:01:14 2017
New Revision: 298721
URL: http://llvm.org/viewvc/llvm-project?rev=298721&view=rev
Log:
[AMDGPU] Add AMDGPUAliasAnalysis to opt pipeline
Previously it was added only to the BE.
Differential Revision: https://reviews.llvm.org/D31323
Added:
llvm/trunk/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll
Modified:
llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp?rev=298721&r1=298720&r2=298721&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp Fri Mar 24 13:01:14 2017
@@ -253,15 +253,29 @@ StringRef AMDGPUTargetMachine::getFeatur
FSAttr.getValueAsString();
}
+static ImmutablePass *createAMDGPUExternalAAWrapperPass() {
+ return createExternalAAWrapperPass([](Pass &P, Function &, AAResults &AAR) {
+ if (auto *WrapperPass = P.getAnalysisIfAvailable<AMDGPUAAWrapperPass>())
+ AAR.addAAResult(WrapperPass->getResult());
+ });
+}
+
void AMDGPUTargetMachine::adjustPassManager(PassManagerBuilder &Builder) {
Builder.DivergentTarget = true;
bool Internalize = InternalizeSymbols &&
(getOptLevel() > CodeGenOpt::None) &&
(getTargetTriple().getArch() == Triple::amdgcn);
+ bool AMDGPUAA = EnableAMDGPUAliasAnalysis && getOptLevel() > CodeGenOpt::None;
+
Builder.addExtension(
PassManagerBuilder::EP_ModuleOptimizerEarly,
- [Internalize](const PassManagerBuilder &, legacy::PassManagerBase &PM) {
+ [Internalize, AMDGPUAA](const PassManagerBuilder &,
+ legacy::PassManagerBase &PM) {
+ if (AMDGPUAA) {
+ PM.add(createAMDGPUAAWrapperPass());
+ PM.add(createAMDGPUExternalAAWrapperPass());
+ }
PM.add(createAMDGPUUnifyMetadataPass());
if (Internalize) {
PM.add(createInternalizePass([=](const GlobalValue &GV) -> bool {
@@ -286,6 +300,15 @@ void AMDGPUTargetMachine::adjustPassMana
PM.add(createAMDGPUAlwaysInlinePass());
}
});
+
+ Builder.addExtension(
+ PassManagerBuilder::EP_EarlyAsPossible,
+ [AMDGPUAA](const PassManagerBuilder &, legacy::PassManagerBase &PM) {
+ if (AMDGPUAA) {
+ PM.add(createAMDGPUAAWrapperPass());
+ PM.add(createAMDGPUExternalAAWrapperPass());
+ }
+ });
}
//===----------------------------------------------------------------------===//
Added: 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=298721&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll (added)
+++ llvm/trunk/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll Fri Mar 24 13:01:14 2017
@@ -0,0 +1,8 @@
+; RUN: opt -mtriple=amdgcn-- -O3 -aa-eval -print-all-alias-modref-info -disable-output < %s 2>&1 | FileCheck %s
+
+; CHECK: NoAlias: i8 addrspace(1)* %p1, i8* %p
+
+define void @test(i8* %p, i8 addrspace(1)* %p1) {
+ ret void
+}
+
More information about the llvm-commits
mailing list