mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
AMDGPU: Minor cleanups to always inline pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242053 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8a2d65cf4a
commit
bae3cf3a1b
@ -22,7 +22,6 @@ using namespace llvm;
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class AMDGPUAlwaysInline : public ModulePass {
|
class AMDGPUAlwaysInline : public ModulePass {
|
||||||
|
|
||||||
static char ID;
|
static char ID;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -36,10 +35,9 @@ public:
|
|||||||
char AMDGPUAlwaysInline::ID = 0;
|
char AMDGPUAlwaysInline::ID = 0;
|
||||||
|
|
||||||
bool AMDGPUAlwaysInline::runOnModule(Module &M) {
|
bool AMDGPUAlwaysInline::runOnModule(Module &M) {
|
||||||
|
std::vector<Function *> FuncsToClone;
|
||||||
|
|
||||||
std::vector<Function*> FuncsToClone;
|
for (Function &F : M) {
|
||||||
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
|
||||||
Function &F = *I;
|
|
||||||
if (!F.hasLocalLinkage() && !F.isDeclaration() && !F.use_empty() &&
|
if (!F.hasLocalLinkage() && !F.isDeclaration() && !F.use_empty() &&
|
||||||
!F.hasFnAttribute(Attribute::NoInline))
|
!F.hasFnAttribute(Attribute::NoInline))
|
||||||
FuncsToClone.push_back(&F);
|
FuncsToClone.push_back(&F);
|
||||||
@ -49,12 +47,11 @@ bool AMDGPUAlwaysInline::runOnModule(Module &M) {
|
|||||||
ValueToValueMapTy VMap;
|
ValueToValueMapTy VMap;
|
||||||
Function *NewFunc = CloneFunction(F, VMap, false);
|
Function *NewFunc = CloneFunction(F, VMap, false);
|
||||||
NewFunc->setLinkage(GlobalValue::InternalLinkage);
|
NewFunc->setLinkage(GlobalValue::InternalLinkage);
|
||||||
F->getParent()->getFunctionList().push_back(NewFunc);
|
M.getFunctionList().push_back(NewFunc);
|
||||||
F->replaceAllUsesWith(NewFunc);
|
F->replaceAllUsesWith(NewFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
for (Function &F : M) {
|
||||||
Function &F = *I;
|
|
||||||
if (F.hasLocalLinkage() && !F.hasFnAttribute(Attribute::NoInline)) {
|
if (F.hasLocalLinkage() && !F.hasFnAttribute(Attribute::NoInline)) {
|
||||||
F.addFnAttr(Attribute::AlwaysInline);
|
F.addFnAttr(Attribute::AlwaysInline);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user