diff options
| author | Manman Ren <mren@apple.com> | 2013-05-14 21:52:44 +0000 |
|---|---|---|
| committer | Manman Ren <mren@apple.com> | 2013-05-14 21:52:44 +0000 |
| commit | b3c52fb45b648ae21780fa8b9d23caeece32edd8 (patch) | |
| tree | a863f7e9f5a0eb2aea7b9644f5fce3ebb5f52c44 /llvm/lib/Transforms | |
| parent | 3c190d7d1c07f79e3d3655ac89a5f3334b260616 (diff) | |
| download | bcm5719-llvm-b3c52fb45b648ae21780fa8b9d23caeece32edd8.tar.gz bcm5719-llvm-b3c52fb45b648ae21780fa8b9d23caeece32edd8.zip | |
GlobalOpt: fix an issue where CXAAtExitFn points to a deleted function.
CXAAtExitFn was set outside a loop and before optimizations where functions
can be deleted. This patch will set CXAAtExitFn inside the loop and after
optimizations.
Seg fault when running LTO because of accesses to a deleted function.
rdar://problem/13838828
llvm-svn: 181838
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 0ef900e2b9a..4a9cb27b034 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -3323,8 +3323,6 @@ bool GlobalOpt::runOnModule(Module &M) { // Try to find the llvm.globalctors list. GlobalVariable *GlobalCtors = FindGlobalCtors(M); - Function *CXAAtExitFn = FindCXAAtExit(M, TLI); - bool LocalChange = true; while (LocalChange) { LocalChange = false; @@ -3342,7 +3340,9 @@ bool GlobalOpt::runOnModule(Module &M) { // Resolve aliases, when possible. LocalChange |= OptimizeGlobalAliases(M); - // Try to remove trivial global destructors. + // Try to remove trivial global destructors if they are not removed + // already. + Function *CXAAtExitFn = FindCXAAtExit(M, TLI); if (CXAAtExitFn) LocalChange |= OptimizeEmptyGlobalCXXDtors(CXAAtExitFn); |

