mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-28 07:05:11 +00:00
[AMDGPU] Add GlobalOpt parameter to Always Inliner pass
If set to false it does not remove global aliases. With this parameter set to false it should be safe to run the pass before link. Differential Revision: https://reviews.llvm.org/D31489 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299108 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
70eccef966
commit
38e381b5a3
@ -98,7 +98,7 @@ extern char &AMDGPUPromoteAllocaID;
|
||||
Pass *createAMDGPUStructurizeCFGPass();
|
||||
FunctionPass *createAMDGPUISelDag(TargetMachine &TM,
|
||||
CodeGenOpt::Level OptLevel);
|
||||
ModulePass *createAMDGPUAlwaysInlinePass();
|
||||
ModulePass *createAMDGPUAlwaysInlinePass(bool GlobalOpt = true);
|
||||
ModulePass *createAMDGPUOpenCLImageTypeLoweringPass();
|
||||
FunctionPass *createAMDGPUAnnotateUniformValues();
|
||||
|
||||
|
@ -24,8 +24,10 @@ namespace {
|
||||
class AMDGPUAlwaysInline : public ModulePass {
|
||||
static char ID;
|
||||
|
||||
bool GlobalOpt;
|
||||
|
||||
public:
|
||||
AMDGPUAlwaysInline() : ModulePass(ID) { }
|
||||
AMDGPUAlwaysInline(bool GlobalOpt) : ModulePass(ID), GlobalOpt(GlobalOpt) { }
|
||||
bool runOnModule(Module &M) override;
|
||||
StringRef getPassName() const override { return "AMDGPU Always Inline Pass"; }
|
||||
};
|
||||
@ -45,8 +47,10 @@ bool AMDGPUAlwaysInline::runOnModule(Module &M) {
|
||||
}
|
||||
}
|
||||
|
||||
for (GlobalAlias* A : AliasesToRemove) {
|
||||
A->eraseFromParent();
|
||||
if (GlobalOpt) {
|
||||
for (GlobalAlias* A : AliasesToRemove) {
|
||||
A->eraseFromParent();
|
||||
}
|
||||
}
|
||||
|
||||
for (Function &F : M) {
|
||||
@ -70,6 +74,6 @@ bool AMDGPUAlwaysInline::runOnModule(Module &M) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ModulePass *llvm::createAMDGPUAlwaysInlinePass() {
|
||||
return new AMDGPUAlwaysInline();
|
||||
ModulePass *llvm::createAMDGPUAlwaysInlinePass(bool GlobalOpt) {
|
||||
return new AMDGPUAlwaysInline(GlobalOpt);
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ void AMDGPUTargetMachine::adjustPassManager(PassManagerBuilder &Builder) {
|
||||
PM.add(createGlobalDCEPass());
|
||||
}
|
||||
if (EarlyInline)
|
||||
PM.add(createAMDGPUAlwaysInlinePass());
|
||||
PM.add(createAMDGPUAlwaysInlinePass(false));
|
||||
});
|
||||
|
||||
Builder.addExtension(
|
||||
|
@ -1,5 +1,8 @@
|
||||
; RUN: opt -mtriple=amdgcn-- -O1 -S -inline-threshold=1 -amdgpu-early-inline-all %s | FileCheck %s
|
||||
|
||||
; CHECK: @c_alias
|
||||
@c_alias = alias i32 (i32), i32 (i32)* @callee
|
||||
|
||||
define i32 @callee(i32 %x) {
|
||||
entry:
|
||||
%mul1 = mul i32 %x, %x
|
||||
|
Loading…
Reference in New Issue
Block a user