[PATCH] D75661: Remove SequentialType from the type heirarchy.
Christopher Tetreault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 25 14:06:07 PDT 2020
ctetreau added inline comments.
================
Comment at: mlir/lib/Target/LLVMIR/ModuleTranslation.cpp:81
static llvm::Type *getInnermostElementType(llvm::Type *type) {
- while (isa<llvm::SequentialType>(type))
- type = type->getSequentialElementType();
- return type;
+ do {
+ if (auto *arrayTy = dyn_cast<llvm::ArrayType>(type)) {
----------------
Readability: This works, but is a little strange. I'd rewrite:
```
static llvm::Type *getInnermostElementType(llvm::Type *type) {
while (isa<llvm::ArrayType>(type) || isa<llvm::VectorType>(type)) {
if (auto *arrayTy = dyn_cast<llvm::ArrayType>(type))
type = arrayTy->getElementType();
else
type = cast<llvm::VectorType>(type)->getElementType();
}
return type;
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75661/new/
https://reviews.llvm.org/D75661
More information about the llvm-commits
mailing list