summaryrefslogtreecommitdiffstats
path: root/llvm/lib/FuzzMutate
diff options
context:
space:
mode:
authorIgor Laevsky <igmyrj@gmail.com>2017-11-30 15:31:13 +0000
committerIgor Laevsky <igmyrj@gmail.com>2017-11-30 15:31:13 +0000
commit33031926b66b80a593856d89e3c05b509ae95c68 (patch)
tree1d3f9948ce18c8eb55ccec85786c75887a4ec5ba /llvm/lib/FuzzMutate
parent65902db27992be02f81efc47051f4253dffce47b (diff)
downloadbcm5719-llvm-33031926b66b80a593856d89e3c05b509ae95c68.tar.gz
bcm5719-llvm-33031926b66b80a593856d89e3c05b509ae95c68.zip
[FuzzMutate] Correctly handle vector types in the insertvalue operation
Differential Revision: https://reviews.llvm.org/D40397 llvm-svn: 319442
Diffstat (limited to 'llvm/lib/FuzzMutate')
-rw-r--r--llvm/lib/FuzzMutate/Operations.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/FuzzMutate/Operations.cpp b/llvm/lib/FuzzMutate/Operations.cpp
index 8bc902edc9c..af2775ebcfb 100644
--- a/llvm/lib/FuzzMutate/Operations.cpp
+++ b/llvm/lib/FuzzMutate/Operations.cpp
@@ -216,8 +216,9 @@ OpDescriptor llvm::fuzzerop::extractValueDescriptor(unsigned Weight) {
static SourcePred matchScalarInAggregate() {
auto Pred = [](ArrayRef<Value *> Cur, const Value *V) {
- if (isa<ArrayType>(Cur[0]->getType()))
- return V->getType() == Cur[0]->getType();
+ if (auto *ArrayT = dyn_cast<ArrayType>(Cur[0]->getType()))
+ return V->getType() == ArrayT->getElementType();
+
auto *STy = cast<StructType>(Cur[0]->getType());
for (int I = 0, E = STy->getNumElements(); I < E; ++I)
if (STy->getTypeAtIndex(I) == V->getType())
@@ -225,8 +226,9 @@ static SourcePred matchScalarInAggregate() {
return false;
};
auto Make = [](ArrayRef<Value *> Cur, ArrayRef<Type *>) {
- if (isa<ArrayType>(Cur[0]->getType()))
- return makeConstantsWithType(Cur[0]->getType());
+ if (auto *ArrayT = dyn_cast<ArrayType>(Cur[0]->getType()))
+ return makeConstantsWithType(ArrayT->getElementType());
+
std::vector<Constant *> Result;
auto *STy = cast<StructType>(Cur[0]->getType());
for (int I = 0, E = STy->getNumElements(); I < E; ++I)
OpenPOWER on IntegriCloud