[llvm] b25aca5 - [OpaquePtr] Use AllocaInst::getAllocatedType()

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 13 09:34:43 PDT 2021


Author: Arthur Eubanks
Date: 2021-07-13T09:34:33-07:00
New Revision: b25aca503d296eeeb2a174d8fb97637de74b8653

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

LOG: [OpaquePtr] Use AllocaInst::getAllocatedType()

Added: 
    

Modified: 
    llvm/lib/Target/NVPTX/NVPTXLowerAlloca.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/NVPTX/NVPTXLowerAlloca.cpp b/llvm/lib/Target/NVPTX/NVPTXLowerAlloca.cpp
index cf488b06f06c7..1bd02552b6668 100644
--- a/llvm/lib/Target/NVPTX/NVPTXLowerAlloca.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXLowerAlloca.cpp
@@ -70,7 +70,7 @@ bool NVPTXLowerAlloca::runOnFunction(Function &F) {
     for (auto &I : BB) {
       if (auto allocaInst = dyn_cast<AllocaInst>(&I)) {
         Changed = true;
-        auto ETy = cast<PointerType>(allocaInst->getType())->getElementType();
+        auto ETy = allocaInst->getAllocatedType();
         auto LocalAddrTy = PointerType::get(ETy, ADDRESS_SPACE_LOCAL);
         auto NewASCToLocal = new AddrSpaceCastInst(allocaInst, LocalAddrTy, "");
         auto GenericAddrTy = PointerType::get(ETy, ADDRESS_SPACE_GENERIC);


        


More information about the llvm-commits mailing list