This is an archive of the discontinued LLVM Phabricator instance.

[FuzzMutate] New InsertPHINode strategy.
ClosedPublic

Authored by Peter on Nov 29 2022, 4:32 PM.

Details

Summary

PHI Node can't be modeled like other instructions since its operand
number depends on predecessors. So we have a stand alone strategy for it.

Signed-off-by: Peter Rong <PeterRong96@gmail.com>

Diff Detail

Event Timeline

Peter created this revision.Nov 29 2022, 4:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 29 2022, 4:32 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
Peter requested review of this revision.Nov 29 2022, 4:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 29 2022, 4:32 PM
Peter updated this revision to Diff 478752.Nov 29 2022, 4:34 PM

code style change

Peter edited the summary of this revision. (Show Details)Nov 29 2022, 4:44 PM
arsenm added inline comments.Nov 30 2022, 11:20 AM
llvm/unittests/FuzzMutate/StrategiesTest.cpp
350

Probably should be assert_false. Otherwise you're proceeding to mutate an invalid module

Peter updated this revision to Diff 479038.Nov 30 2022, 11:30 AM

use ASSERT to abort failed test immediately.

Peter marked an inline comment as done.Nov 30 2022, 11:30 AM
arsenm requested changes to this revision.Nov 30 2022, 11:45 AM
arsenm added inline comments.
llvm/lib/FuzzMutate/IRMutator.cpp
310

s/Prev/Pred

314–315

If a predecessor block branches to the same block multiple times (e.g. it's the target of multiple switch cases), the same incoming value needs to appear for each instance. Can you add such a case to the test?

This revision now requires changes to proceed.Nov 30 2022, 11:45 AM
Peter updated this revision to Diff 479068.Nov 30 2022, 2:16 PM

bug fix. Should have same value for incoming edges from the same block.
Using DenseMap to keep track of the value used for each incoming edge instead of SmallVector
Add a unit test to reflect this change.

arsenm accepted this revision.Nov 30 2022, 3:04 PM
This revision is now accepted and ready to land.Nov 30 2022, 3:04 PM
This revision was automatically updated to reflect the committed changes.
Peter marked 2 inline comments as done.Nov 30 2022, 3:27 PM