From 7749d7ccc7b45573eb360d0bda21b32e470eb134 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 25 Oct 2013 21:29:52 +0000 Subject: Handle calls and invokes in GlobalStatus. This patch teaches GlobalStatus to analyze a call that uses the global value as a callee, not as an argument. With this change internalize call handle the common use of linkonce_odr functions. This reduces the number of linkonce_odr functions in a LTO build of clang (checked with the emit-llvm gold plugin option) from 1730 to 60. llvm-svn: 193436 --- llvm/lib/Transforms/Utils/GlobalStatus.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib/Transforms/Utils/GlobalStatus.cpp') diff --git a/llvm/lib/Transforms/Utils/GlobalStatus.cpp b/llvm/lib/Transforms/Utils/GlobalStatus.cpp index 8fb79aa87b3..5f0a563ceec 100644 --- a/llvm/lib/Transforms/Utils/GlobalStatus.cpp +++ b/llvm/lib/Transforms/Utils/GlobalStatus.cpp @@ -11,6 +11,7 @@ #include "llvm/IR/BasicBlock.h" #include "llvm/IR/GlobalVariable.h" #include "llvm/IR/IntrinsicInst.h" +#include "llvm/Support/CallSite.h" #include "llvm/Transforms/Utils/GlobalStatus.h" using namespace llvm; @@ -148,6 +149,10 @@ static bool analyzeGlobalAux(const Value *V, GlobalStatus &GS, if (MSI->isVolatile()) return true; GS.StoredType = GlobalStatus::Stored; + } else if (ImmutableCallSite C = I) { + if (!C.isCallee(UI)) + return true; + GS.IsLoaded = true; } else { return true; // Any other non-load instruction might take address! } -- cgit v1.2.3