aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/MergeFunctions.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2010-07-16 06:31:12 +0000
committerNick Lewycky <nicholas@mxc.ca>2010-07-16 06:31:12 +0000
commit394ce41b7fcb64a35d5cd1c1fefc0e2225ebfc01 (patch)
tree24b335e4c3388d86820dad6a3fb8fbe812851926 /lib/Transforms/IPO/MergeFunctions.cpp
parent384271b57ddc158236de0929863dfda4daf14851 (diff)
Arrays and vectors with different numbers of elements are not equivalent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108517 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/MergeFunctions.cpp')
-rw-r--r--lib/Transforms/IPO/MergeFunctions.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Transforms/IPO/MergeFunctions.cpp b/lib/Transforms/IPO/MergeFunctions.cpp
index aeeafe7fd1..87b10f2e87 100644
--- a/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/lib/Transforms/IPO/MergeFunctions.cpp
@@ -216,11 +216,17 @@ static bool isEquivalentType(const Type *Ty1, const Type *Ty2) {
return true;
}
- case Type::ArrayTyID:
+ case Type::ArrayTyID: {
+ const ArrayType *ATy1 = cast<ArrayType>(Ty1);
+ const ArrayType *ATy2 = cast<ArrayType>(Ty2);
+ return ATy1->getNumElements() == ATy2->getNumElements() &&
+ isEquivalentType(ATy1->getElementType(), ATy2->getElementType());
+ }
case Type::VectorTyID: {
- const SequentialType *STy1 = cast<SequentialType>(Ty1);
- const SequentialType *STy2 = cast<SequentialType>(Ty2);
- return isEquivalentType(STy1->getElementType(), STy2->getElementType());
+ const VectorType *VTy1 = cast<VectorType>(Ty1);
+ const VectorType *VTy2 = cast<VectorType>(Ty2);
+ return VTy1->getNumElements() == VTy2->getNumElements() &&
+ isEquivalentType(VTy1->getElementType(), VTy2->getElementType());
}
}
}