mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
AMDGPU: Minor cleanups to always inline pass
llvm-svn: 242053
This commit is contained in:
parent
31202c91fa
commit
cba55da3c1
@ -22,7 +22,6 @@ using namespace llvm;
|
||||
namespace {
|
||||
|
||||
class AMDGPUAlwaysInline : public ModulePass {
|
||||
|
||||
static char ID;
|
||||
|
||||
public:
|
||||
@ -36,10 +35,9 @@ public:
|
||||
char AMDGPUAlwaysInline::ID = 0;
|
||||
|
||||
bool AMDGPUAlwaysInline::runOnModule(Module &M) {
|
||||
std::vector<Function *> FuncsToClone;
|
||||
|
||||
std::vector<Function*> FuncsToClone;
|
||||
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
||||
Function &F = *I;
|
||||
for (Function &F : M) {
|
||||
if (!F.hasLocalLinkage() && !F.isDeclaration() && !F.use_empty() &&
|
||||
!F.hasFnAttribute(Attribute::NoInline))
|
||||
FuncsToClone.push_back(&F);
|
||||
@ -49,12 +47,11 @@ bool AMDGPUAlwaysInline::runOnModule(Module &M) {
|
||||
ValueToValueMapTy VMap;
|
||||
Function *NewFunc = CloneFunction(F, VMap, false);
|
||||
NewFunc->setLinkage(GlobalValue::InternalLinkage);
|
||||
F->getParent()->getFunctionList().push_back(NewFunc);
|
||||
M.getFunctionList().push_back(NewFunc);
|
||||
F->replaceAllUsesWith(NewFunc);
|
||||
}
|
||||
|
||||
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
||||
Function &F = *I;
|
||||
for (Function &F : M) {
|
||||
if (F.hasLocalLinkage() && !F.hasFnAttribute(Attribute::NoInline)) {
|
||||
F.addFnAttr(Attribute::AlwaysInline);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user