1
0
mirror of https://github.com/c64scene-ar/llvm-6502.git synced 2025-03-25 00:35:30 +00:00

Reapply r64300:

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@64443 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky 2009-02-13 07:15:53 +00:00
parent 826f7cebfd
commit 8968a07768
2 changed files with 14 additions and 4 deletions
lib/Analysis/IPA
test/Transforms/SimplifyLibCalls

@ -135,8 +135,13 @@ bool CGPassManager::doInitialization(CallGraph &CG) {
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(CG.getModule());
}
}
return Changed;
}
@ -146,8 +151,13 @@ bool CGPassManager::doFinalization(CallGraph &CG) {
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(CG.getModule());
}
}
return Changed;
}

@ -1,7 +1,7 @@
; RUN: llvm-as < %s | opt -std-compile-opts | llvm-dis | grep nocapture | count 2
; RUN: llvm-as < %s | opt -inline -simplify-libcalls -functionattrs | \
; RUN: llvm-dis | grep nocapture | count 2
; Check that nocapture attributes are added when run after an SCC pass.
; PR3520
; XFAIL: *
define i32 @use(i8* %x) nounwind readonly {
entry: