[OpaquePtr] Use AllocaInst::getAllocatedType()
authorArthur Eubanks <aeubanks@google.com>
Tue, 13 Jul 2021 16:25:28 +0000 (09:25 -0700)
committerArthur Eubanks <aeubanks@google.com>
Tue, 13 Jul 2021 16:34:33 +0000 (09:34 -0700)
llvm/lib/Target/NVPTX/NVPTXLowerAlloca.cpp

index cf488b06f06c77d0330329713991ded35bb8c9bc..1bd02552b66688c0be11d2021f52ab291753dada 100644 (file)
@@ -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);