This is an archive of the discontinued LLVM Phabricator instance.

Create a MachineBasicBlock for created IR-level BasicBlock
ClosedPublic

Authored by paquette on May 1 2018, 1:24 PM.

Details

Reviewers
chandlerc
Summary

While running the lit tests for the most recent version of D45916 (https://reviews.llvm.org/D45916), I found that a couple tests for this pass suddenly started segfaulting. Since the outliner wasn't actually doing anything to the code in either of these tests I got curious.

I found that the pass doesn’t completely create the machine-level constructs necessary to actually add a MachineFunction and MachineBasicBlock to the module. This patch adds in those missing bits. After this, adding the outliner before this pass won’t cause it to segfault.

You can recreate this behaviour by adding the MachineOutliner directly before the pass and having it return false immediately.

Diff Detail

Event Timeline

paquette created this revision.May 1 2018, 1:24 PM
chandlerc accepted this revision.May 1 2018, 1:30 PM

Good catch, thanks! LGTM

lib/Target/X86/X86RetpolineThunks.cpp
226

using end() would seem a touch more idiomatic to me? Clearly doesn't actually matter much...

This revision is now accepted and ready to land.May 1 2018, 1:30 PM
paquette closed this revision.May 1 2018, 1:53 PM
paquette marked an inline comment as done.

Thanks! Switched the begin() to end() as suggested.

Committed in r331307.