summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lib/Transforms/IPO/ExtractGV.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-01-14 19:55:43 +0000
committerpatrick <patrick@openbsd.org>2017-01-14 19:55:43 +0000
commitbd3306aecb3a15e8967143b8cdbbccf2b1b19b74 (patch)
tree309a8132b44564b9e634c0da6815187ce8eab27c /gnu/llvm/lib/Transforms/IPO/ExtractGV.cpp
parentkillp -a should not kill the window if only one pane. (diff)
downloadwireguard-openbsd-bd3306aecb3a15e8967143b8cdbbccf2b1b19b74.tar.xz
wireguard-openbsd-bd3306aecb3a15e8967143b8cdbbccf2b1b19b74.zip
Import LLVM 3.9.1 including clang and lld.
Diffstat (limited to 'gnu/llvm/lib/Transforms/IPO/ExtractGV.cpp')
-rw-r--r--gnu/llvm/lib/Transforms/IPO/ExtractGV.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/gnu/llvm/lib/Transforms/IPO/ExtractGV.cpp b/gnu/llvm/lib/Transforms/IPO/ExtractGV.cpp
index 1a3b9253d72..479fd182598 100644
--- a/gnu/llvm/lib/Transforms/IPO/ExtractGV.cpp
+++ b/gnu/llvm/lib/Transforms/IPO/ExtractGV.cpp
@@ -68,6 +68,9 @@ namespace {
: ModulePass(ID), Named(GVs.begin(), GVs.end()), deleteStuff(deleteS) {}
bool runOnModule(Module &M) override {
+ if (skipModule(M))
+ return false;
+
// Visit the global inline asm.
if (!deleteStuff)
M.setModuleInlineAsm("");
@@ -101,20 +104,20 @@ namespace {
}
// Visit the Functions.
- for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
+ for (Function &F : M) {
bool Delete =
- deleteStuff == (bool)Named.count(&*I) && !I->isDeclaration();
+ deleteStuff == (bool)Named.count(&F) && !F.isDeclaration();
if (!Delete) {
- if (I->hasAvailableExternallyLinkage())
+ if (F.hasAvailableExternallyLinkage())
continue;
}
- makeVisible(*I, Delete);
+ makeVisible(F, Delete);
if (Delete) {
// Make this a declaration and drop it's comdat.
- I->deleteBody();
- I->setComdat(nullptr);
+ F.deleteBody();
+ F.setComdat(nullptr);
}
}
@@ -128,7 +131,7 @@ namespace {
makeVisible(*CurI, Delete);
if (Delete) {
- Type *Ty = CurI->getType()->getElementType();
+ Type *Ty = CurI->getValueType();
CurI->removeFromParent();
llvm::Value *Declaration;