From: Matt Arsenault Date: Thu, 9 Jan 2020 16:03:17 +0000 (-0500) Subject: GlobalISel: Fix else after return X-Git-Tag: llvmorg-11-init~500 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ac53a5f1dc21916f1072031703e0e1833e963454;p=platform%2Fupstream%2Fllvm.git GlobalISel: Fix else after return --- diff --git a/llvm/lib/CodeGen/LowLevelType.cpp b/llvm/lib/CodeGen/LowLevelType.cpp index d4baf56..40dfa69 100644 --- a/llvm/lib/CodeGen/LowLevelType.cpp +++ b/llvm/lib/CodeGen/LowLevelType.cpp @@ -24,15 +24,21 @@ LLT llvm::getLLTForType(Type &Ty, const DataLayout &DL) { if (NumElements == 1) return ScalarTy; return LLT::vector(NumElements, ScalarTy); - } else if (auto PTy = dyn_cast(&Ty)) { - return LLT::pointer(PTy->getAddressSpace(), DL.getTypeSizeInBits(&Ty)); - } else if (Ty.isSized()) { + } + + if (auto PTy = dyn_cast(&Ty)) { + unsigned AddrSpace = PTy->getAddressSpace(); + return LLT::pointer(AddrSpace, DL.getPointerSizeInBits(AddrSpace)); + } + + if (Ty.isSized()) { // Aggregates are no different from real scalars as far as GlobalISel is // concerned. auto SizeInBits = DL.getTypeSizeInBits(&Ty); assert(SizeInBits != 0 && "invalid zero-sized type"); return LLT::scalar(SizeInBits); } + return LLT(); }