This is an archive of the discontinued LLVM Phabricator instance.

[llvm-reduce] Skip chunks that lead to broken modules.
ClosedPublic

Authored by fhahn on Aug 19 2020, 6:24 AM.

Details

Summary

Some reduction passes may create invalid IR. I am not aware of any use
case where we would like to proceed reducing invalid IR. Various utils
used here, including CloneModule, assume the module to clone is valid
and crash otherwise.

Ideally, no reduction pass would create invalid IR, but some currently
do. ReduceInstructions can be fixed relatively easily (D86210), but
others are harder. For example, ReduceBasicBlocks may remove result in
invalid PHI nodes.

For now, skip the chunks. If we get to the point where all reduction
passes result in valid IR, we may want to turn this into an assertion.

Diff Detail

Event Timeline

fhahn created this revision.Aug 19 2020, 6:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 19 2020, 6:24 AM
fhahn requested review of this revision.Aug 19 2020, 6:24 AM
lebedev.ri accepted this revision.Aug 22 2020, 1:57 PM

I've been deliberating on this, but i guess this makes sense..
I personally always had opt -verify as the first interestingness check.

llvm/tools/llvm-reduce/deltas/Delta.cpp
142

I think it may be better to say:

// Some reductions may result in invalid IR. Skip such reductions.
This revision is now accepted and ready to land.Aug 22 2020, 1:57 PM
fhahn marked an inline comment as done.Aug 28 2020, 1:12 AM

I've been deliberating on this, but i guess this makes sense..
I personally always had opt -verify as the first interestingness check.

Great thanks! Discarding the invalid paths a bit earlier might be a bit faster and I think the behavior will save people some time with the result being always valid IR. If there are use-cases where we actually want invalid IR we can relax the check again.

This revision was landed with ongoing or failed builds.Aug 28 2020, 1:13 AM
This revision was automatically updated to reflect the committed changes.