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

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 31 14:08:56 PDT 2023


arsenm added inline comments.


================
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());
----------------
Peter wrote:
> arsenm wrote:
> > Shouldn't bother handling typed pointers?
> I'm sorry I don't fully understand. What do you mean we shouldn't handle typed pointers? Since we have no knowledge what we are mutating on, I think we should consider the possibility that the pointer is typed.
You can just drop the isOpaqueOrPointeeTypeMatches check, pointers are always opaque now


================
Comment at: llvm/lib/FuzzMutate/RandomIRBuilder.cpp:125-126
+      Function *F = BB.getParent();
+      // Somehow I can't use iterators to init these vectors, it will have type
+      // mismatch.
+      SmallVector<Argument *, 8> Args;
----------------
Drop comment


================
Comment at: llvm/lib/FuzzMutate/RandomIRBuilder.cpp:141-142
+      for (BasicBlock *Dom : Dominators) {
+        // Somehow I can't use iterators to init these vectors, it will have
+        // type mismatch.
+        SmallVector<Instruction *, 16> Instructions;
----------------
Drop comment


================
Comment at: llvm/lib/FuzzMutate/RandomIRBuilder.cpp:284-286
+        // TODO: Replacing operands of intrinsics would be interesting,
+        // but there's no easy way to verify that a given replacement is
+        // valid given that intrinsics can impose arbitrary constraints.
----------------
Not really, you just need to avoid touching immarg parameters


================
Comment at: llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp:360
+      ConstantFP::get(Ctx, APFloat::getZero(DoubleTy->getFltSemantics()));
+  std::vector<Type *> Types = {
+      Int32Ty,
----------------
Can just use a regular array or std::array, you never resize these


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