diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-12-02 03:20:58 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-12-02 03:20:58 +0000 |
commit | bc0705240e0f57f16919382b3b75263df9a9f2a5 (patch) | |
tree | 1ff0e7415c4d6295cb4baa6ea63b4b38469ff123 /llvm/lib/Transforms/Utils/FunctionComparator.cpp | |
parent | c3be225895ec2373753b2a23f5aced6bad872d81 (diff) | |
download | bcm5719-llvm-bc0705240e0f57f16919382b3b75263df9a9f2a5.tar.gz bcm5719-llvm-bc0705240e0f57f16919382b3b75263df9a9f2a5.zip |
IR: Move NumElements field from {Array,Vector}Type to SequentialType.
Now that PointerType is no longer a SequentialType, all SequentialTypes
have an associated number of elements, so we can move that information to
the base class, allowing for a number of simplifications.
Differential Revision: https://reviews.llvm.org/D27122
llvm-svn: 288464
Diffstat (limited to 'llvm/lib/Transforms/Utils/FunctionComparator.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/FunctionComparator.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Utils/FunctionComparator.cpp b/llvm/lib/Transforms/Utils/FunctionComparator.cpp index 1cb75b49c01..81a7c4ceffa 100644 --- a/llvm/lib/Transforms/Utils/FunctionComparator.cpp +++ b/llvm/lib/Transforms/Utils/FunctionComparator.cpp @@ -387,12 +387,6 @@ int FunctionComparator::cmpTypes(Type *TyL, Type *TyR) const { case Type::IntegerTyID: return cmpNumbers(cast<IntegerType>(TyL)->getBitWidth(), cast<IntegerType>(TyR)->getBitWidth()); - case Type::VectorTyID: { - VectorType *VTyL = cast<VectorType>(TyL), *VTyR = cast<VectorType>(TyR); - if (int Res = cmpNumbers(VTyL->getNumElements(), VTyR->getNumElements())) - return Res; - return cmpTypes(VTyL->getElementType(), VTyR->getElementType()); - } // TyL == TyR would have returned true earlier, because types are uniqued. case Type::VoidTyID: case Type::FloatTyID: @@ -445,12 +439,13 @@ int FunctionComparator::cmpTypes(Type *TyL, Type *TyR) const { return 0; } - case Type::ArrayTyID: { - ArrayType *ATyL = cast<ArrayType>(TyL); - ArrayType *ATyR = cast<ArrayType>(TyR); - if (ATyL->getNumElements() != ATyR->getNumElements()) - return cmpNumbers(ATyL->getNumElements(), ATyR->getNumElements()); - return cmpTypes(ATyL->getElementType(), ATyR->getElementType()); + case Type::ArrayTyID: + case Type::VectorTyID: { + auto *STyL = cast<SequentialType>(TyL); + auto *STyR = cast<SequentialType>(TyR); + if (STyL->getNumElements() != STyR->getNumElements()) + return cmpNumbers(STyL->getNumElements(), STyR->getNumElements()); + return cmpTypes(STyL->getElementType(), STyR->getElementType()); } } } |