This is an archive of the discontinued LLVM Phabricator instance.

[MachineCombiner] Fix initialisation of LastUpdate for incremental update.
ClosedPublic

Authored by paulwalker-arm on Oct 10 2017, 7:52 AM.

Details

Summary

Fixes a bogus iterator resulting from the removal of a block's first instruction at the point that incremental update is enabled.

Patch by Paul Walker.

Diff Detail

Event Timeline

paulwalker-arm created this revision.Oct 10 2017, 7:52 AM
fhahn edited edge metadata.

LGTM, thanks for fixing that Paul! Unless there are any additional concerns, I can commit your change tomorrow.

Just to re-iterate, the test/CodeGen/AArch64/machine-combiner.mir was added because in the IR version of the test case, the bug would not be triggered, as the DAGCombiner would kick in before the MachineCombiner. We might want to convert the existing machine-combiner.ll test case to a MIR case, to make sure this test actually exercises the MachineCombiner.

lib/CodeGen/MachineCombiner.cpp
417

just out of curiosity, would auto auto BlockIter = MBB->begin(), LastUpdate; work?

fhahn accepted this revision.Oct 10 2017, 8:12 AM
This revision is now accepted and ready to land.Oct 10 2017, 8:12 AM
aemerson added inline comments.
lib/CodeGen/MachineCombiner.cpp
417

At this point just use the type explicitly?

MatzeB edited edge metadata.Oct 10 2017, 9:23 AM

Please take a look at http://llvm.org/docs/MIRLangRef.html#simplifying-mir-files and simplify the test.

As requested I've simplified the patch's mir test.

paulwalker-arm added inline comments.Oct 11 2017, 4:48 AM
lib/CodeGen/MachineCombiner.cpp
417

The first suggestion is not valid C++. Given the surrounding code, decltype seems like the correct choice. I can make the types explicit, but then why allow auto in the first place?

aemerson added inline comments.Oct 11 2017, 7:44 AM
lib/CodeGen/MachineCombiner.cpp
417

No objection from me, just think: MachineBasicBlock::iterator BlockIter = MBB->begin(), LastUpdate; is nicer in this case.

Florian I think you're good to commit.

Gerolf edited edge metadata.Oct 11 2017, 10:43 AM

Thanks for working on this. LGTM!

-Gerolf

fhahn edited the summary of this revision. (Show Details)Oct 11 2017, 1:24 PM
fhahn closed this revision.Oct 11 2017, 1:26 PM
fhahn added a comment.Oct 11 2017, 1:26 PM

Thanks everyone!