Commit 7b158652 authored by Simon Pilgrim's avatar Simon Pilgrim
Browse files

Fix "pointer is null" static analyzer warning. NFCI.

Use cast<> instead of dyn_cast<> since the pointer is always dereferenced and cast<> will perform the null assertion for us.
parent 7570d387
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -70,8 +70,7 @@ bool NVPTXLowerAlloca::runOnFunction(Function &F) {
    for (auto &I : BB) {
      if (auto allocaInst = dyn_cast<AllocaInst>(&I)) {
        Changed = true;
        auto PTy = dyn_cast<PointerType>(allocaInst->getType());
        auto ETy = PTy->getElementType();
        auto ETy = cast<PointerType>(allocaInst->getType())->getElementType();
        auto LocalAddrTy = PointerType::get(ETy, ADDRESS_SPACE_LOCAL);
        auto NewASCToLocal = new AddrSpaceCastInst(allocaInst, LocalAddrTy, "");
        auto GenericAddrTy = PointerType::get(ETy, ADDRESS_SPACE_GENERIC);