mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-17 05:31:32 +00:00
Make sure the SCC pass manager initializes any contained
function pass managers. Without this, simplify-libcalls would add nocapture attributes when run on its own, but not when run as part of -std-compile-opts or similar. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64300 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
46dec95319
commit
af068750a7
@ -40,8 +40,8 @@ public:
|
||||
/// whether any of the passes modifies the module, and if so, return true.
|
||||
bool runOnModule(Module &M);
|
||||
|
||||
bool doInitialization(CallGraph &CG);
|
||||
bool doFinalization(CallGraph &CG);
|
||||
bool doInitialization(CallGraph &CG, Module &M);
|
||||
bool doFinalization(CallGraph &CG, Module &M);
|
||||
|
||||
/// Pass Manager itself does not invalidate any analysis info.
|
||||
void getAnalysisUsage(AnalysisUsage &Info) const {
|
||||
@ -82,7 +82,7 @@ char CGPassManager::ID = 0;
|
||||
/// whether any of the passes modifies the module, and if so, return true.
|
||||
bool CGPassManager::runOnModule(Module &M) {
|
||||
CallGraph &CG = getAnalysis<CallGraph>();
|
||||
bool Changed = doInitialization(CG);
|
||||
bool Changed = doInitialization(CG, M);
|
||||
|
||||
// Walk SCC
|
||||
for (scc_iterator<CallGraph*> I = scc_begin(&CG), E = scc_end(&CG);
|
||||
@ -126,28 +126,38 @@ bool CGPassManager::runOnModule(Module &M) {
|
||||
removeDeadPasses(P, "", ON_CG_MSG);
|
||||
}
|
||||
}
|
||||
Changed |= doFinalization(CG);
|
||||
Changed |= doFinalization(CG, M);
|
||||
return Changed;
|
||||
}
|
||||
|
||||
/// Initialize CG
|
||||
bool CGPassManager::doInitialization(CallGraph &CG) {
|
||||
bool CGPassManager::doInitialization(CallGraph &CG, Module &M) {
|
||||
bool Changed = false;
|
||||
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
|
||||
Pass *P = getContainedPass(Index);
|
||||
if (CallGraphSCCPass *CGSP = dynamic_cast<CallGraphSCCPass *>(P))
|
||||
if (CallGraphSCCPass *CGSP = dynamic_cast<CallGraphSCCPass *>(P)) {
|
||||
Changed |= CGSP->doInitialization(CG);
|
||||
} else {
|
||||
FPPassManager *FP = dynamic_cast<FPPassManager *>(P);
|
||||
assert (FP && "Invalid CGPassManager member");
|
||||
Changed |= FP->doInitialization(M);
|
||||
}
|
||||
}
|
||||
return Changed;
|
||||
}
|
||||
|
||||
/// Finalize CG
|
||||
bool CGPassManager::doFinalization(CallGraph &CG) {
|
||||
bool CGPassManager::doFinalization(CallGraph &CG, Module &M) {
|
||||
bool Changed = false;
|
||||
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
|
||||
Pass *P = getContainedPass(Index);
|
||||
if (CallGraphSCCPass *CGSP = dynamic_cast<CallGraphSCCPass *>(P))
|
||||
if (CallGraphSCCPass *CGSP = dynamic_cast<CallGraphSCCPass *>(P)) {
|
||||
Changed |= CGSP->doFinalization(CG);
|
||||
} else {
|
||||
FPPassManager *FP = dynamic_cast<FPPassManager *>(P);
|
||||
assert (FP && "Invalid CGPassManager member");
|
||||
Changed |= FP->doFinalization(M);
|
||||
}
|
||||
}
|
||||
return Changed;
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
; RUN: llvm-as < %s | opt -std-compile-opts | llvm-dis | grep nocapture | count 2
|
||||
; Check that nocapture attributes are added when run after an SCC pass.
|
||||
; PR3520
|
||||
|
||||
define i32 @use(i8* %x) nounwind readonly {
|
||||
entry:
|
||||
%0 = tail call i64 @strlen(i8* %x) nounwind readonly ; <i64> [#uses=1]
|
||||
%1 = trunc i64 %0 to i32 ; <i32> [#uses=1]
|
||||
ret i32 %1
|
||||
}
|
||||
|
||||
declare i64 @strlen(i8*) nounwind readonly
|
Loading…
x
Reference in New Issue
Block a user