From 99173fd03a079a788376c5cb993bc413ed8e020b Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Sat, 1 May 2021 21:44:32 -0700 Subject: [PATCH] [NFC] Use Aliasee to determine Type and AddrSpace in GlobalAlias::create() As opposed to going through the Aliasee type. For opaque pointers, we're trying to remove uses of PointerType::getElementType(). Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D101715 --- llvm/lib/IR/Globals.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp index c2cbe7d..b1c6dcc 100644 --- a/llvm/lib/IR/Globals.cpp +++ b/llvm/lib/IR/Globals.cpp @@ -502,8 +502,7 @@ GlobalAlias *GlobalAlias::create(Type *Ty, unsigned AddressSpace, GlobalAlias *GlobalAlias::create(LinkageTypes Link, const Twine &Name, GlobalValue *Aliasee) { - PointerType *PTy = Aliasee->getType(); - return create(PTy->getElementType(), PTy->getAddressSpace(), Link, Name, + return create(Aliasee->getValueType(), Aliasee->getAddressSpace(), Link, Name, Aliasee); } -- 2.7.4