summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-10-25 21:29:52 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-10-25 21:29:52 +0000
commit0f978ea45945bf3b8f2ce20f46d78dc840894623 (patch)
treef4530b935c5be83b41b669610d72aab832e45115 /lib
parent006183a9364660daba786d352df720e079412d60 (diff)
downloadllvm-0f978ea45945bf3b8f2ce20f46d78dc840894623.tar.gz
llvm-0f978ea45945bf3b8f2ce20f46d78dc840894623.tar.bz2
llvm-0f978ea45945bf3b8f2ce20f46d78dc840894623.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193436 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Utils/GlobalStatus.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Utils/GlobalStatus.cpp b/lib/Transforms/Utils/GlobalStatus.cpp
index 8fb79aa87b..5f0a563cee 100644
--- a/lib/Transforms/Utils/GlobalStatus.cpp
+++ b/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!
}