[PATCH] D139907: [FuzzMutate] RandomIRBuilder has more source and sink type now.

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 22 05:26:07 PST 2022


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


================
Comment at: llvm/lib/FuzzMutate/RandomIRBuilder.cpp:42
+/// block
+template <typename DomTree = DominatorTree>
+static std::vector<BasicBlock *> getDominatees(BasicBlock *BB) {
----------------
You shouldn't need this template stuff, you're operating directly on IR with the IR version of the tree?


================
Comment at: llvm/lib/FuzzMutate/RandomIRBuilder.cpp:129
+      // mismatch.
+      std::vector<Argument *> Args;
+      for (uint64_t i = 0; i < F->arg_size(); i++) {
----------------
SmallVector


================
Comment at: llvm/lib/FuzzMutate/RandomIRBuilder.cpp:176
+        // If no one is using this GlobalVariable, delete it too.
+        if (GV->hasNUses(0)) {
+          GV->eraseFromParent();
----------------
use_empty


================
Comment at: llvm/lib/FuzzMutate/RandomIRBuilder.cpp:317
+          if (PointerType *PtrTy = dyn_cast<PointerType>(I.getType())) {
+            if (PtrTy->isOpaqueOrPointeeTypeMatches(V->getType())) {
+              return new StoreInst(V, &I, Insts.back());
----------------
Shouldn't bother handling typed pointers?


================
Comment at: llvm/lib/FuzzMutate/RandomIRBuilder.cpp:342
+      return newSink(BB, Insts, V);
+      break;
+    case SinkToGlobalVariable: {
----------------
Dead break


================
Comment at: llvm/lib/FuzzMutate/RandomIRBuilder.cpp:353
+      llvm_unreachable("EndOfValueSink executed");
+    };
   }
----------------
Extra ;


================
Comment at: llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp:265
+    if (LoadInst *LI = dyn_cast<LoadInst>(V)) {
+      ASSERT_TRUE(LI->getOperand(0) != FuncPtr);
+      ASSERT_TRUE(LI->getOperand(0) != OpaquePtr);
----------------
I think there is an ASSERT_NE


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139907



More information about the llvm-commits mailing list