This is an archive of the discontinued LLVM Phabricator instance.

[LVI] Don't use dominator tree in isValidAssumeForContext()
ClosedPublic

Authored by nikic on Mar 25 2020, 1:00 PM.

Details

Summary

LVI and its consumers currently have quite a bit of complexity related to dominator tree management. However, it doesn't look like it is actually needed...

The only use of the dominator tree is inside isValidAssumeForContext(). However, due to the way LVI queries work, I don't think this is needed. If we query a value for some block, we will first get the edge values from all predecessor blocks, which also includes an intersection with assumptions that apply to the terminator of the predecessor. As such, we will already have processed all assumptions from predecessor blocks (this is actually stronger than what isValidAssumeForContext does with a DT, because this is capable of combining non-dominating assumptions). The only additional assumptions we need to take into account are those in the block being queried. And we don't need a dominator tree for that.

This patch only removes the use of DT. If it lands, I will remove the whole disableDT/enableDT machinery in a followup, because it becomes unused.

Diff Detail

Event Timeline

nikic created this revision.Mar 25 2020, 1:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2020, 1:00 PM
lebedev.ri resigned from this revision.Apr 8 2020, 11:46 PM

No idea who is comfortable/qualified doing LVI reviews, but that isn't me.

efriedma edited reviewers, added: fhahn; removed: lebedev.ri.Apr 19 2020, 1:08 PM
fhahn accepted this revision.May 17 2020, 6:55 AM

LGTM, thanks! The non-local assumption should be applied when processing the containing basic block, as mentioned in the description.

This revision is now accepted and ready to land.May 17 2020, 6:55 AM
This revision was automatically updated to reflect the committed changes.