This is an archive of the discontinued LLVM Phabricator instance.

Cowardly refuse to insert instructions after a terminator.
Needs ReviewPublic

Authored by arnt on Apr 12 2019, 5:55 AM.

Details

Reviewers
craig.topper
vsk
Summary

Allowing instructions to be added after a terminator just invites trouble later. Better to assert early, so the bug is easy to spot.

Diff Detail

Event Timeline

arnt created this revision.Apr 12 2019, 5:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2019, 5:55 AM
arnt added a comment.Apr 12 2019, 5:57 AM

FWIW, I picked reviewers by taking the last two people who changed the file. I hope reviewing this isn't too much of an inconvenience ;)

arnt updated this revision to Diff 194857.Apr 12 2019, 6:06 AM

LebedevRI pointed out that the assert ought to have a message; thanks.

vsk added a comment.Apr 12 2019, 8:13 AM

Thanks for working on this. Two thoughts:

  • Would the old test fail with the new assert? I don’t yet see why it would.
  • Might help to preemptively test this with a stage 2 clang self-host, in case any in-tree code “fixes up” extra terminators.
arnt added a comment.Apr 12 2019, 9:20 AM

The old test did break, yes, that's why I changed it at all. The six branch instructions I moved down were all followed by phi nodes.

I'll start a clang rebuild one night. Haven't done it yet.