[all-commits] [llvm/llvm-project] d38205: [SimplifyCFG] FoldBranchToCommonDest(): bonus inst...
Roman Lebedev via All-commits
all-commits at lists.llvm.org
Sat Dec 12 13:07:41 PST 2020
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d38205144febf4dc42c9270c6aa3d978f1ef65e1
https://github.com/llvm/llvm-project/commit/d38205144febf4dc42c9270c6aa3d978f1ef65e1
Author: Roman Lebedev <lebedev.ri at gmail.com>
Date: 2020-12-13 (Sun, 13 Dec 2020)
Changed paths:
M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
M llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
Log Message:
-----------
[SimplifyCFG] FoldBranchToCommonDest(): bonus instrns must only be used by PHI nodes in successors (PR48450)
In particular, if the successor block, which is about to get a new
predecessor block, currently only has a single predecessor,
then the bonus instructions will be directly used within said successor,
which is fine, since the block with bonus instructions dominates that
successor. But once there's a new predecessor, the IR is no longer valid,
and we don't fix it, because we only update PHI nodes.
Which means, the live-out bonus instructions must be exclusively used
by the PHI nodes in successor blocks. So we have to form trivial PHI nodes.
which will then be successfully updated to recieve cloned bonus instns.
This all works fine, except for the fact that we don't have access to
the dominator tree, and we don't ignore unreachable code,
so we sometimes do end up having to deal with some weird IR.
Fixes https://bugs.llvm.org/show_bug.cgi?id=48450
More information about the All-commits
mailing list