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 | 6f9646c3788d01f552aa87c9940f978c66b758b0 (patch) | |
tree | 41557de289cef4f75422d5e361caeec15ea8de63 | |
parent | df872b8ad57d9bacb8411a565e064bc1fa9dc3b2 (diff) | |
download | external_llvm-6f9646c3788d01f552aa87c9940f978c66b758b0.zip external_llvm-6f9646c3788d01f552aa87c9940f978c66b758b0.tar.gz external_llvm-6f9646c3788d01f552aa87c9940f978c66b758b0.tar.bz2 |
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
-rw-r--r-- | lib/Analysis/IPA/CallGraphSCCPass.cpp | 14 | ||||
-rw-r--r-- | test/Transforms/SimplifyLibCalls/2009-02-11-NotInitialized.ll | 4 |
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/IPA/CallGraphSCCPass.cpp index b8343cf..3880d0a 100644 --- a/lib/Analysis/IPA/CallGraphSCCPass.cpp +++ b/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/test/Transforms/SimplifyLibCalls/2009-02-11-NotInitialized.ll b/test/Transforms/SimplifyLibCalls/2009-02-11-NotInitialized.ll index 41ab1d1..551a2bb 100644 --- a/test/Transforms/SimplifyLibCalls/2009-02-11-NotInitialized.ll +++ b/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: |