[FlattenCFG] Fix `MergeIfRegion` in case then-path is empty
authorEhud Katz <ehudkatz@gmail.com>
Thu, 21 May 2020 11:06:44 +0000 (14:06 +0300)
committerEhud Katz <ehudkatz@gmail.com>
Thu, 21 May 2020 11:06:44 +0000 (14:06 +0300)
commit111ddc57d3804d31c6d101821abd9688b3e0decc
treefdc143600d122ef0d56823cd5a8029781b130e99
parenteeff1a970a6bb09d3c046313e229e2871929cd63
[FlattenCFG] Fix `MergeIfRegion` in case then-path is empty

In case the then-path of an if-region is empty, then merging with the
else-path should be handled with the inverse of the condition (leading
to that path).

Fix PR37662

Differential Revision: https://reviews.llvm.org/D78881
llvm/lib/Transforms/Utils/FlattenCFG.cpp
llvm/test/Transforms/Util/flattencfg.ll