[PATCH] D139894: [FuzzMutate] introduce vector operations, select and fneg into InstInjectorStrategy
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 12 19:05:53 PST 2022
arsenm requested changes to this revision.
arsenm added inline comments.
This revision now requires changes to proceed.
================
Comment at: llvm/include/llvm/FuzzMutate/OpDescriptor.h:95-106
+using TypeMatch = std::function<bool(Type *)>;
+static inline SourcePred anyXOrVecXType(TypeMatch TM) {
+ auto Pred = [TM](ArrayRef<Value *>, const Value *V) {
+ Type *Ty = V->getType();
+ if (VectorType *VecTy = dyn_cast<VectorType>(Ty)) {
+ Ty = VecTy->getElementType();
+ }
----------------
This is just Type::getScalarType
================
Comment at: llvm/include/llvm/FuzzMutate/OpDescriptor.h:104
+ };
+ auto Make = std::nullopt;
+ return {Pred, Make};
----------------
No need for make
================
Comment at: llvm/include/llvm/FuzzMutate/OpDescriptor.h:138-146
+static inline SourcePred boolOrVecBoolType() {
+ return anyXOrVecXType([](Type *Ty) {
+ if (IntegerType *IntTy = dyn_cast<IntegerType>(Ty)) {
+ return IntTy->getBitWidth() == 1;
+ } else {
+ return false;
+ }
----------------
This is just Ty->isIntOrIntVectorTy(1)
================
Comment at: llvm/include/llvm/FuzzMutate/OpDescriptor.h:157
+static inline SourcePred anyFloatOrVecFloatType() {
+ return anyXOrVecXType([](Type *Ty) { return Ty->isFloatingPointTy(); });
+}
----------------
Ty->isFPOrFPVectorTy()
================
Comment at: llvm/include/llvm/FuzzMutate/OpDescriptor.h:208
+ return ThisVec->getElementCount() == FirstVec->getElementCount();
+ } else {
+ return (ThisVec == nullptr) && (FirstVec == nullptr) &&
----------------
no else after return
================
Comment at: llvm/include/llvm/FuzzMutate/OpDescriptor.h:223
+ for (Type *T : BaseTypes) {
+ // We don't do nested vectors yet.
+ if (!T->isVectorTy() && !T->isVoidTy()) {
----------------
Pretty sure those don't exist. Closest would be vectors in arrays, which I don't think support arithmetic operations
================
Comment at: llvm/unittests/FuzzMutate/StrategiesTest.cpp:37-38
+ // Add vector 2, 4, and 8.
+ int VectorLength[] = {2, 4, 8};
+ std::vector<TypeGetter> BasicTypeGetters(Types);
----------------
The odd sizes, particularly 1 and 3, are most likely to break something
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139894/new/
https://reviews.llvm.org/D139894
More information about the llvm-commits
mailing list