summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2013-03-19 21:46:49 +0000
committerQuentin Colombet <qcolombet@apple.com>2013-03-19 21:46:49 +0000
commit2393cb92b8238cb6972c8c13fc16e03ecce19711 (patch)
tree674b48e65a600ed3eb000a2a793a7539a2eb998f /llvm/lib
parent84b81dee55c5f0ec2255741d2da2b3b78539972f (diff)
downloadbcm5719-llvm-2393cb92b8238cb6972c8c13fc16e03ecce19711.tar.gz
bcm5719-llvm-2393cb92b8238cb6972c8c13fc16e03ecce19711.zip
Update global merge pass according to Duncan's advices:
- Remove useless includes - Change misleading comments - Move code into doFinalization llvm-svn: 177445
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/GlobalMerge.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Scalar/GlobalMerge.cpp b/llvm/lib/Transforms/Scalar/GlobalMerge.cpp
index 14e463ad2db..5d02c68a7a4 100644
--- a/llvm/lib/Transforms/Scalar/GlobalMerge.cpp
+++ b/llvm/lib/Transforms/Scalar/GlobalMerge.cpp
@@ -61,10 +61,8 @@
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
-#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
-#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
@@ -101,7 +99,7 @@ namespace {
/// Collect every variables marked as "used"
void collectUsedGlobalVariables(Module &M);
- /// Keep track of the GlobalVariable that are marked as "used"
+ /// Keep track of the GlobalVariable that must not be merged away
SmallPtrSet<const GlobalVariable *, 16> MustKeepGlobalVariables;
public:
@@ -113,6 +111,7 @@ namespace {
virtual bool doInitialization(Module &M);
virtual bool runOnFunction(Function &F);
+ virtual bool doFinalization(Module &M);
const char *getPassName() const {
return "Merge internal globals";
@@ -211,9 +210,6 @@ void GlobalMerge::collectUsedGlobalVariables(Module &M) {
}
void GlobalMerge::setMustKeepGlobalVariables(Module &M) {
- // If we already processed a Module, UsedGlobalVariables may have been
- // populated. Reset the information for this module.
- MustKeepGlobalVariables.clear();
collectUsedGlobalVariables(M);
for (Module::iterator IFn = M.begin(), IEndFn = M.end(); IFn != IEndFn;
@@ -268,8 +264,6 @@ bool GlobalMerge::doInitialization(Module &M) {
continue;
// Ignore all "required" globals:
- // - the ones used for EH
- // - the ones marked with "used" attribute
if (isMustKeepGlobalVariable(I))
continue;
@@ -307,6 +301,11 @@ bool GlobalMerge::runOnFunction(Function &F) {
return false;
}
+bool GlobalMerge::doFinalization(Module &M) {
+ MustKeepGlobalVariables.clear();
+ return false;
+}
+
Pass *llvm::createGlobalMergePass(const TargetLowering *tli) {
return new GlobalMerge(tli);
}
OpenPOWER on IntegriCloud