From 807bc2a3814bb45b38702785ad9978153d176698 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Tue, 22 Mar 2011 03:21:01 +0000 Subject: [PATCH] Handle another case that Frits suggested. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128068 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/IPO/GlobalOpt.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 7f69aeb0d02..0087362e339 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -2746,11 +2746,13 @@ static bool cxxDtorIsEmpty(const Function &Fn, if (!CalledFn) return false; + SmallPtrSet NewCalledFunctions(CalledFunctions); + // Don't treat recursive functions as empty. - if (!CalledFunctions.insert(CalledFn)) + if (!NewCalledFunctions.insert(CalledFn)) return false; - if (!cxxDtorIsEmpty(*CalledFn, CalledFunctions)) + if (!cxxDtorIsEmpty(*CalledFn, NewCalledFunctions)) return false; } else if (isa(*I)) return true;