diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2009-02-13 07:15:53 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2009-02-13 07:15:53 +0000 |
commit | cdccffe731a8a10aade46d30df31aa478bdd9325 (patch) | |
tree | ccd110aeca5655f73c630cc1b1dcde85622d42e4 /llvm | |
parent | c60bd012bcc7843d7ad71fae3b040d402dba319f (diff) | |
download | bcm5719-llvm-cdccffe731a8a10aade46d30df31aa478bdd9325.tar.gz bcm5719-llvm-cdccffe731a8a10aade46d30df31aa478bdd9325.zip |
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
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp | 14 | ||||
-rw-r--r-- | llvm/test/Transforms/SimplifyLibCalls/2009-02-11-NotInitialized.ll | 4 |
2 files changed, 14 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp b/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp index b8343cf4ce8..3880d0a10bb 100644 --- a/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp +++ b/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp @@ -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; } diff --git a/llvm/test/Transforms/SimplifyLibCalls/2009-02-11-NotInitialized.ll b/llvm/test/Transforms/SimplifyLibCalls/2009-02-11-NotInitialized.ll index 41ab1d145fb..551a2bb6b99 100644 --- a/llvm/test/Transforms/SimplifyLibCalls/2009-02-11-NotInitialized.ll +++ b/llvm/test/Transforms/SimplifyLibCalls/2009-02-11-NotInitialized.ll @@ -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: |