[PATCH] D84763: DomTree: Make PostDomTree immune to block successors swap

Yevgeny Rouban via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 28 08:42:34 PDT 2020


yrouban created this revision.
yrouban added reviewers: lebedev.ri, nikic.
Herald added a subscriber: mgrang.
Herald added a project: LLVM.
yrouban requested review of this revision.

This is another fix for the bug 46098 <https://bugs.llvm.org/show_bug.cgi?id=46098> "PostDominatorTree is different than a freshly computed one!" with opt -branch-prob -instcombine -block-freq -verify-dom-info

One of the fixes is the patch D81089 <https://reviews.llvm.org/D81089> proposed to mark InstCombine as non-PreserveCFG pass if its branch predicate canonicalization swapped any branch successors. It causes re-calculation of CFG analysis that may impact performance.

Another approach (work-in-progres D84491 <https://reviews.llvm.org/D84491>, D84492 <https://reviews.llvm.org/D84492>, D84493 <https://reviews.llvm.org/D84493> and D84495 <https://reviews.llvm.org/D84495>) is to move all the branch successors swapping transformations from InstCombine to SimplifyCFG. It needs much work to change many tests and may affect many user pipelines.

This fix is proposed by @kuhar in D81089 <https://reviews.llvm.org/D81089>: 
//... to chose some arbitrary way of selecting a fake-entry node from nodes in an scc. Right now this order is whatever children or inverse_children return, but could be based on the order of blocks in a function instead ...//.
So, while looking for the //furthest away// node in a reverse unreachable subgraph this patch runs DFS with successors in their function order. This order is indifferent to the order of successors, so is the //furthest away// node.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84763

Files:
  llvm/include/llvm/Support/GenericDomTreeConstruction.h
  llvm/test/Transforms/InstCombine/infinite-loop-postdom.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84763.281242.patch
Type: text/x-patch
Size: 6820 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200728/a1cf68c6/attachment.bin>


More information about the llvm-commits mailing list