This is an archive of the discontinued LLVM Phabricator instance.

[FuzzMutate] Fix a bug in `connectToSink` which might invalidate the whole module.
ClosedPublic

Authored by Peter on Nov 28 2022, 7:51 PM.

Details

Summary

connectToSink uses a value by putting it in a future instruction.
It will replace the operand of a future instruction with the current value.

However, if current value is an Instruction and put into a switch case, the module is invalid.
We fix that by only connecting to Br/Switch's condition, and don't touch other operands.

Will have other strategies to mutate other Br/Switch operands to be patched once this patch is passed

Diff Detail

Event Timeline

Peter created this revision.Nov 28 2022, 7:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 28 2022, 7:51 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
Peter requested review of this revision.Nov 28 2022, 7:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 28 2022, 7:51 PM
Peter updated this revision to Diff 478637.Nov 29 2022, 10:42 AM

rebase to working commit

arsenm accepted this revision.Nov 29 2022, 12:48 PM

LGTM with nits

llvm/lib/FuzzMutate/RandomIRBuilder.cpp
95

Typo ConstnatInt

llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp
337

ASSERT_FALSE(verifyModule)

This revision is now accepted and ready to land.Nov 29 2022, 12:48 PM
Peter updated this revision to Diff 478696.Nov 29 2022, 1:00 PM

typo and code style fix

Peter marked 2 inline comments as done.Nov 29 2022, 1:00 PM
arsenm accepted this revision.Nov 29 2022, 1:04 PM
arsenm added inline comments.
llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp
320

std::array if possible

This revision was landed with ongoing or failed builds.Nov 29 2022, 1:07 PM
This revision was automatically updated to reflect the committed changes.