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 | 8968a0776801c5662863b3a461550aa361f69ba3 (patch) | |
tree | 41557de289cef4f75422d5e361caeec15ea8de63 | |
parent | 826f7cebfd347bf2218ba35486bc13623523ed7f (diff) |
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 b8343cf4ce..3880d0a10b 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 41ab1d145f..551a2bb6b9 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: |