This is an archive of the discontinued LLVM Phabricator instance.

[llvm-reduce] Skip terminators when reducing instructions.
ClosedPublic

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

Details

Summary

Removing terminators will result in invalid IR, making further
reductions pointless. I do not think there is any valid use case where
we actually want to create invalid IR as part of a reduction.

Diff Detail

Event Timeline

fhahn created this revision.Aug 19 2020, 6:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 19 2020, 6:06 AM
fhahn requested review of this revision.Aug 19 2020, 6:06 AM
fhahn updated this revision to Diff 286557.Aug 19 2020, 7:29 AM

Add test for PR43798, adjust existing tests that checked that the terminator was actually removed.

fhahn added a comment.Aug 19 2020, 7:30 AM

Yes, it should fix the bug.

I missed the tests directory initially, assuming the tests would live under llvm/test/tools/llvm-reduce.. Added tests now.

lebedev.ri accepted this revision.Aug 22 2020, 2:01 PM

Honestly i don't like this, mainly because this could result in valid reduction
deleting *all* instructions, but then yes, it more frequently results in broken IR.
So i think this will do after all. Thanks.

This revision is now accepted and ready to land.Aug 22 2020, 2:01 PM
fhahn added a comment.Aug 23 2020, 9:55 AM

Honestly i don't like this, mainly because this could result in valid reduction
deleting *all* instructions, but then yes, it more frequently results in broken IR.
So i think this will do after all. Thanks.

Thanks for taking a look! Happy to adjust things down the road if it turns out we are now missing any useful reductions.

This revision was landed with ongoing or failed builds.Aug 23 2020, 9:56 AM
This revision was automatically updated to reflect the committed changes.