DomTree: Make PostDomTree indifferent to block successors swap
authorYevgeny Rouban <yrouban@azul.com>
Wed, 5 Aug 2020 04:06:54 +0000 (11:06 +0700)
committerYevgeny Rouban <yrouban@azul.com>
Wed, 5 Aug 2020 07:26:32 +0000 (14:26 +0700)
commitbc10888dcdda1fe80a983029bc50eec4b248cc77
tree0cb205f4876a3933948cfee5c89a9ab8b918fc89
parent521c0b2659074c512d292dc30da78c862782d34c
DomTree: Make PostDomTree indifferent to block successors swap

Fixed the commit c35585e209efe69e2233bdc5ecd23bed7b735ba3.

This is a fix for the bug 46098 where PostDominatorTree
is unexpectedly changed by InstCombine's branch swapping
transformation.
This patch fixes PostDomTree builder. 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.

Reviewers: kuhar, nikic, lebedev.ri
Differential Revision: https://reviews.llvm.org/D84763
llvm/include/llvm/Support/GenericDomTreeConstruction.h
llvm/test/Transforms/InstCombine/infinite-loop-postdom.ll [new file with mode: 0644]