This is an archive of the discontinued LLVM Phabricator instance.

Add a pass to bugpoint to make it transform conditional jumps into unconditional jumps.
ClosedPublic

Authored by dberlin on Jul 26 2016, 6:28 PM.

Details

Summary

Add a pass to bugpoint to make it transform conditional jumps into unconditional jumps.

Often, bugpoint generates output that has large numbers of br undef jumps, where
one side is dead.

What is happening is two fold:

  1. It never tries to just pick a direction for the jump, and just see what happens

<<<< this patch

  1. SimplifyCFG no longer is a good match for bugpoint's usecase. It

does too much.
Even things in SimplifyCFG, like removeUnreachableBlocks, go to great
lengths to transform undefined behavior into blocks and kill large
parts of the CFG. This is great for regular code, not so much for
bugpoint, which often generates UB on purpose (store undef is a great
example).
<<<< a followup patch that is coming, to move simplifycfg into a
separate reduction pass, and move the existing reduceCrashingBlocks
pass to use simpleSimplifyCFG.

Both of these patches significantly reduce the size and complexity of bugpoint
generated testcases.

Diff Detail

Repository
rL LLVM

Event Timeline

dberlin retitled this revision from to Add a pass to bugpoint to make it transform conditional jumps into unconditional jumps..
dberlin updated this object.
dberlin added reviewers: chandlerc, majnemer.
dberlin added a subscriber: llvm-commits.
majnemer added inline comments.Jul 26 2016, 6:42 PM
tools/bugpoint/CrashDebugger.cpp
446 ↗(On Diff #65640)

Is it possible for MergeBlockIntoPredecessor to destroy a block that we haven't yet processed in BBs?

506–507 ↗(On Diff #65640)

Range-based for loop?

521–522 ↗(On Diff #65640)

Range-based for loops?

524 ↗(On Diff #65640)

auto *

539 ↗(On Diff #65640)

Range-based for loops?

540 ↗(On Diff #65640)

Hoist this out of the loop and clear on every iteration?

565 ↗(On Diff #65640)

Range-based for loop?

566 ↗(On Diff #65640)

auto *

silvas added a subscriber: silvas.Jul 26 2016, 6:54 PM

This would have really helped reducing https://llvm.org/bugs/show_bug.cgi?id=28608
Thanks for doing this!

dberlin marked 7 inline comments as done.Jul 26 2016, 6:58 PM
dberlin added inline comments.
tools/bugpoint/CrashDebugger.cpp
446 ↗(On Diff #65640)

As far as i can tell: No.
It only can destroy block we are processing.

  • Update for review comments
majnemer accepted this revision.Jul 27 2016, 6:47 AM
majnemer edited edge metadata.

LGTM with a nit fixed.

tools/bugpoint/CrashDebugger.cpp
566 ↗(On Diff #65648)

Space before the {

This revision is now accepted and ready to land.Jul 27 2016, 6:47 AM
This revision was automatically updated to reflect the committed changes.