This is an archive of the discontinued LLVM Phabricator instance.

[FuzzMutate] InsertFunctionStrategy
ClosedPublic

Authored by Peter on Apr 17 2023, 1:57 PM.

Details

Summary

InsertFunctionStrategy does two things:

  1. Add a random function declaration or definition to the module. This would replace previously used createEmptyFunction.
  2. Add a random function call between instructions.

Diff Detail

Event Timeline

Peter created this revision.Apr 17 2023, 1:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2023, 1:57 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
Peter requested review of this revision.Apr 17 2023, 1:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2023, 1:57 PM
arsenm added inline comments.Apr 17 2023, 4:24 PM
llvm/lib/FuzzMutate/IRMutator.cpp
346

Don't see the point of the initializer here

359

arg_empty

Peter updated this revision to Diff 514466.Apr 17 2023, 5:03 PM
Peter marked 2 inline comments as done.

use arg_empty

Peter updated this revision to Diff 514516.Apr 17 2023, 8:54 PM

[FuzzMutate] InsertFunctionStrategy

InsertFunctionStrategy does two things:

Add a random function declaration or definition to the module. This would replace previously used createEmptyFunction.
Add a random function call between instructions.

Peter updated this revision to Diff 514816.Apr 18 2023, 8:22 PM

sync with upstream

Peter added inline comments.Apr 19 2023, 9:18 AM
llvm/lib/FuzzMutate/IRMutator.cpp
346

If the mutator select nullptr, we can create a new function. This is to give us a chance to define more functions.

359

Fixed, thanks for pointint out.

Peter updated this revision to Diff 515030.Apr 19 2023, 11:39 AM

sync with upstream

arsenm added inline comments.Apr 19 2023, 12:43 PM
llvm/lib/FuzzMutate/IRMutator.cpp
374

Can use make_range(BB.getFirstInsertionPt(), BB.end())

llvm/lib/FuzzMutate/RandomIRBuilder.cpp
426

Missing alloca address space

Peter updated this revision to Diff 515087.Apr 19 2023, 2:06 PM
Peter marked an inline comment as done.

use make range and add address space

Peter marked an inline comment as done.Apr 19 2023, 2:07 PM
arsenm accepted this revision.Apr 19 2023, 7:38 PM
This revision is now accepted and ready to land.Apr 19 2023, 7:38 PM
This revision was landed with ongoing or failed builds.Apr 19 2023, 8:09 PM
This revision was automatically updated to reflect the committed changes.