diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2020-01-09 11:03:17 -0500 |
|---|---|---|
| committer | Matt Arsenault <arsenm2@gmail.com> | 2020-01-09 17:37:52 -0500 |
| commit | ac53a5f1dc21916f1072031703e0e1833e963454 (patch) | |
| tree | b16042d6fb043ddf206b62140f2f1dfda260ccd0 /llvm/lib/CodeGen | |
| parent | 255cc5a7603fef251192daab2a3336acbcd9aa1c (diff) | |
| download | bcm5719-llvm-ac53a5f1dc21916f1072031703e0e1833e963454.tar.gz bcm5719-llvm-ac53a5f1dc21916f1072031703e0e1833e963454.zip | |
GlobalISel: Fix else after return
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/LowLevelType.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/LowLevelType.cpp b/llvm/lib/CodeGen/LowLevelType.cpp index d4baf56635e..40dfa696a2b 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<PointerType>(&Ty)) { - return LLT::pointer(PTy->getAddressSpace(), DL.getTypeSizeInBits(&Ty)); - } else if (Ty.isSized()) { + } + + if (auto PTy = dyn_cast<PointerType>(&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(); } |

