[llvm] 99173fd - [NFC] Use Aliasee to determine Type and AddrSpace in GlobalAlias::create()

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Sun May 2 11:50:23 PDT 2021


Author: Arthur Eubanks
Date: 2021-05-02T11:50:08-07:00
New Revision: 99173fd03a079a788376c5cb993bc413ed8e020b

URL: https://github.com/llvm/llvm-project/commit/99173fd03a079a788376c5cb993bc413ed8e020b
DIFF: https://github.com/llvm/llvm-project/commit/99173fd03a079a788376c5cb993bc413ed8e020b.diff

LOG: [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

Added: 
    

Modified: 
    llvm/lib/IR/Globals.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp
index c2cbe7ddddf84..b1c6dcc6672de 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);
 }
 


        


More information about the llvm-commits mailing list