1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01: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.

llvm-svn: 64443
This commit is contained in:
Nick Lewycky 2009-02-13 07:15:53 +00:00
parent f6c8dc0825
commit 260e80bd90
2 changed files with 14 additions and 4 deletions

View File

@ -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;
}

View File

@ -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: