From 4f735ca1855bb66974f3b1c4ee493534d5037eda Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sun, 20 Mar 2011 20:21:33 +0000 Subject: [PATCH] Don't try to eliminate invokes to __cxa_atexit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127976 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/IPO/GlobalOpt.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 1a8b944363f..2b9b7f24302 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -2780,6 +2780,12 @@ bool GlobalOpt::OptimizeEmptyGlobalCXXDtors(Function *CXAAtExitFn) { if (!CS) continue; + // We're only interested in calls. Theoretically, we could handle invoke + // instructions as well, but neither llvm-gcc nor clang generate invokes + // to __cxa_atexit. + if (!CS.isCall()) + continue; + Function *DtorFn = dyn_cast(CS.getArgument(0)->stripPointerCasts()); if (!DtorFn) -- 2.34.1