This is an archive of the discontinued LLVM Phabricator instance.

[CodeGenPrepare] Fix bad IR created by large offset GEP splitting.
ClosedPublic

Authored by efriedma on Dec 14 2018, 4:54 PM.

Details

Summary

Creating the IR builder, then modifying the CFG, leads to an IRBuilder where the BB and insertion point are inconsistent, so new instructions have the wrong parent.

Modified an existing test because the test wasn't covering anything useful (the "invoke" was not actually an invoke by the time we hit the code in question).

It would be nice if IRBuilder could give an assertion for this, somehow... I'll think about it.

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma created this revision.Dec 14 2018, 4:54 PM

@spatel - Can you have a look at this patch?

dmgreen accepted this revision.Dec 18 2018, 1:11 PM

Looks good to me. Apologies for the delay.

This revision is now accepted and ready to land.Dec 18 2018, 1:11 PM
spatel accepted this revision.Dec 18 2018, 1:37 PM

I've never looked at that chunk of CGP before, but the code change looks strictly safer, so LGTM too.
It would be nicer if that test file had an 'opt -codegenprepare' RUN with complete IR output, so we could see exactly what's happening there to the IR, but that could be a follow-up patch.

@efriedma Can you commit this one, or are you having second thoughts about it?

This revision was automatically updated to reflect the committed changes.