[PATCH] D139067: [FuzzMutate] New InsertCFGStrategy

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 9 14:33:00 PST 2022


arsenm requested changes to this revision.
arsenm added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/FuzzMutate/IRMutator.cpp:343-344
+                    }));
+    assert(RS && "I can't find an integer type in all allowed types, is the "
+                 "setting correct?");
+    Type *Ty = RS.getSelection();
----------------
assert string is a bit weird


================
Comment at: llvm/lib/FuzzMutate/IRMutator.cpp:346-347
+    Type *Ty = RS.getSelection();
+    IntegerType *IntTy = dyn_cast<IntegerType>(Ty);
+    assert(IntTy && "I should got an IntegerType.");
+
----------------
cast<> instead of dyn_cast and assert


================
Comment at: llvm/lib/FuzzMutate/IRMutator.cpp:365-374
+    for (uint64_t i = 0; i < NumCases; i++) {
+      uint64_t CaseVal = [&CaseVals, MaxCaseVal, &IB]() {
+        uint64_t tmp;
+        // Make sure we don't have two cases with same value.
+        do {
+          tmp = uniform<uint64_t>(IB.Rand, 0, MaxCaseVal);
+        } while (CaseVals.count(tmp) != 0);
----------------
Why is this a lambda here?


================
Comment at: llvm/lib/FuzzMutate/IRMutator.cpp:406
+      Value *RetValue = nullptr;
+      if (RetTy != Type::getVoidTy(C))
+        RetValue =
----------------
RetTy->isVoidTy()


================
Comment at: llvm/lib/FuzzMutate/RandomIRBuilder.cpp:80
+    /// TODO: For all Allocas, maybe allocate an array.
+    AllocaInst *Alloca = new AllocaInst(Ty, 0, "A", EntryBB->getTerminator());
+    StoreInst *Store =
----------------
Should query the datalayout address space for new allocas


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139067/new/

https://reviews.llvm.org/D139067



More information about the llvm-commits mailing list