[llvm] ef10f98 - [TLI] getMemValueType - break apart if-else chain and use auto with dyn_cast (style). NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 16 07:33:17 PDT 2023
Author: Simon Pilgrim
Date: 2023-03-16T14:33:04Z
New Revision: ef10f98643c3a5aff96f7d23e7f5341b06a01b2f
URL: https://github.com/llvm/llvm-project/commit/ef10f98643c3a5aff96f7d23e7f5341b06a01b2f
DIFF: https://github.com/llvm/llvm-project/commit/ef10f98643c3a5aff96f7d23e7f5341b06a01b2f.diff
LOG: [TLI] getMemValueType - break apart if-else chain and use auto with dyn_cast (style). NFC.
More closely matches getValueType
Added:
Modified:
llvm/include/llvm/CodeGen/TargetLowering.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index 606f5631cc85..f94994a901b1 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -1526,15 +1526,16 @@ class TargetLoweringBase {
EVT getMemValueType(const DataLayout &DL, Type *Ty,
bool AllowUnknown = false) const {
// Lower scalar pointers to native pointer types.
- if (PointerType *PTy = dyn_cast<PointerType>(Ty))
+ if (auto *PTy = dyn_cast<PointerType>(Ty))
return getPointerMemTy(DL, PTy->getAddressSpace());
- else if (VectorType *VTy = dyn_cast<VectorType>(Ty)) {
- Type *Elm = VTy->getElementType();
- if (PointerType *PT = dyn_cast<PointerType>(Elm)) {
- EVT PointerTy(getPointerMemTy(DL, PT->getAddressSpace()));
- Elm = PointerTy.getTypeForEVT(Ty->getContext());
+
+ if (auto *VTy = dyn_cast<VectorType>(Ty)) {
+ Type *EltTy = VTy->getElementType();
+ if (auto *PTy = dyn_cast<PointerType>(EltTy)) {
+ EVT PointerTy(getPointerMemTy(DL, PTy->getAddressSpace()));
+ EltTy = PointerTy.getTypeForEVT(Ty->getContext());
}
- return EVT::getVectorVT(Ty->getContext(), EVT::getEVT(Elm, false),
+ return EVT::getVectorVT(Ty->getContext(), EVT::getEVT(EltTy, false),
VTy->getElementCount());
}
More information about the llvm-commits
mailing list