forked from OSchip/llvm-project
[Polly] Don't prune non-external function itself from dump.
This commit is contained in:
parent
b35e636e40
commit
e4f3f2c0c5
|
@ -43,9 +43,15 @@ static void runDumpFunction(llvm::Function &F, StringRef Suffix) {
|
||||||
return GV == &F;
|
return GV == &F;
|
||||||
};
|
};
|
||||||
std::unique_ptr<Module> CM = CloneModule(*M, VMap, ShouldCloneDefinition);
|
std::unique_ptr<Module> CM = CloneModule(*M, VMap, ShouldCloneDefinition);
|
||||||
|
Function *NewF = cast<Function>(VMap.lookup(&F));
|
||||||
|
assert(NewF && "Expected selected function to be cloned");
|
||||||
|
|
||||||
LLVM_DEBUG(dbgs() << "Global DCE...\n");
|
LLVM_DEBUG(dbgs() << "Global DCE...\n");
|
||||||
|
|
||||||
|
// Stop F itself from being pruned
|
||||||
|
GlobalValue::LinkageTypes OrigLinkage = NewF->getLinkage();
|
||||||
|
NewF->setLinkage(GlobalValue::ExternalLinkage);
|
||||||
|
|
||||||
{
|
{
|
||||||
ModuleAnalysisManager MAM;
|
ModuleAnalysisManager MAM;
|
||||||
ModulePassManager MPM;
|
ModulePassManager MPM;
|
||||||
|
@ -58,6 +64,9 @@ static void runDumpFunction(llvm::Function &F, StringRef Suffix) {
|
||||||
MPM.run(*CM, MAM);
|
MPM.run(*CM, MAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restore old linkage
|
||||||
|
NewF->setLinkage(OrigLinkage);
|
||||||
|
|
||||||
LLVM_DEBUG(dbgs() << "Write to file '" << Dumpfile << "'...\n");
|
LLVM_DEBUG(dbgs() << "Write to file '" << Dumpfile << "'...\n");
|
||||||
|
|
||||||
std::unique_ptr<ToolOutputFile> Out;
|
std::unique_ptr<ToolOutputFile> Out;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
@callee_alias = dso_local unnamed_addr alias void(i32, double*, i32), void(i32, double*, i32 )* @callee
|
@callee_alias = dso_local unnamed_addr alias void(i32, double*, i32), void(i32, double*, i32 )* @callee
|
||||||
|
|
||||||
define void @callee(i32 %n, double* noalias nonnull %A, i32 %i) {
|
define internal void @callee(i32 %n, double* noalias nonnull %A, i32 %i) {
|
||||||
entry:
|
entry:
|
||||||
br label %for
|
br label %for
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ return:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
define void @caller(i32 %n, double* noalias nonnull %A) {
|
define internal void @caller(i32 %n, double* noalias nonnull %A) {
|
||||||
entry:
|
entry:
|
||||||
br label %for
|
br label %for
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue