This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Fix regression with not maintaining MachineDominatorTree
ClosedPublic

Authored by scott.linder on Sep 6 2018, 11:10 AM.

Details

Summary

Fix regression introduced in https://reviews.llvm.org/D50982 where the MDT was not kept up-to-date when new MachineBasicBlocks were added.

Diff Detail

Event Timeline

scott.linder created this revision.Sep 6 2018, 11:10 AM

Looks good, but Matt needs to approve.
Also do you need a test?

The regression was caught by the expensive_checks build, if that is sufficient for testing? I am actually not sure how to write a lit test for this, because opt -analyze will just re-calculate the DT; I don't know how to just print the DT after the legalize pass runs.

Update existing tests RUN lines with -verify-machine-dom-info. This replicates what the expensive tests enabled.

Update patch to include all changes since the original patch was reverted.

The regression was caught by the expensive_checks build, if that is sufficient for testing? I am actually not sure how to write a lit test for this, because opt -analyze will just re-calculate the DT; I don't know how to just print the DT after the legalize pass runs.

lib/Target/AMDGPU/SIInstrInfo.cpp
3708

Braces

3709–3711

I think this is right, but does the new dominator tree update API support MachineDominatorTrees yet?

3857

Braces

4043

This should be an optional operand since we could want to use this in the future from a pass that doesn't require the dominator tree

Address feedback: make MDT optional, add braces, run clang-format.

I was not aware of the new DT update API, but as far as I can tell it doesn't support MDT yet. MDT contains a DT, but it is not a subclass. It maintains some state on top of the DT which is resolved in batches, so directly updating the contained DT underneath it doesn't seem correct.

arsenm accepted this revision.Oct 5 2018, 1:20 AM

LGTM

This revision is now accepted and ready to land.Oct 5 2018, 1:20 AM
This revision was automatically updated to reflect the committed changes.