summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-05-16 13:34:04 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-05-16 13:34:04 +0000
commitab67b30df6b14e8e90f4778215ed4e1d5939638e (patch)
tree0dd738ae6d07cd9fac9f37bc7f34dbea1d7014c1 /lib/Transforms/IPO
parentb95580a711b70e373ba7a52b3867e7ea6881e413 (diff)
downloadllvm-ab67b30df6b14e8e90f4778215ed4e1d5939638e.tar.gz
llvm-ab67b30df6b14e8e90f4778215ed4e1d5939638e.tar.bz2
llvm-ab67b30df6b14e8e90f4778215ed4e1d5939638e.tar.xz
Change the GlobalAlias constructor to look a bit more like GlobalVariable.
This is part of the fix for pr10367. A GlobalAlias always has a pointer type, so just have the constructor build the type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208983 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/MergeFunctions.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/IPO/MergeFunctions.cpp b/lib/Transforms/IPO/MergeFunctions.cpp
index 59b6c22aa4..a8106e0c32 100644
--- a/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/lib/Transforms/IPO/MergeFunctions.cpp
@@ -1328,8 +1328,10 @@ void MergeFunctions::writeThunk(Function *F, Function *G) {
// Replace G with an alias to F and delete G.
void MergeFunctions::writeAlias(Function *F, Function *G) {
Constant *BitcastF = ConstantExpr::getBitCast(F, G->getType());
- GlobalAlias *GA = new GlobalAlias(G->getType(), G->getLinkage(), "",
- BitcastF, G->getParent());
+ PointerType *PTy = G->getType();
+ GlobalAlias *GA =
+ new GlobalAlias(PTy->getElementType(), G->getLinkage(), "", BitcastF,
+ G->getParent(), PTy->getAddressSpace());
F->setAlignment(std::max(F->getAlignment(), G->getAlignment()));
GA->takeName(G);
GA->setVisibility(G->getVisibility());