[PATCH] D69865: [IR] PR27065: Part2. Fix BasicBlock::removePredecessor to not break SSA form.
Denis Bakhvalov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 5 11:34:20 PST 2019
dendibakh created this revision.
dendibakh added reviewers: lebedev.ri, spatel, grosser.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
BasicBlock::removePredecessor replaces phi nodes with single entry even if it will generate self-referencing instructions and break SSA form. This patch fixes this behavior.
Logic regarding the change in CloneFunction.cpp:
- We prevent replacing phi nodes in BasicBlock::removePredecessor only in the cases where it will break SSA form.
- Since it was working before, i.e. verifier did not complain, it means that the code was dead. Then, it shouldn't matter if we skip blocks that still have phi nodes.
See example in the lit test in this patch.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D69865
Files:
llvm/lib/IR/BasicBlock.cpp
llvm/lib/Transforms/Utils/CloneFunction.cpp
llvm/test/Transforms/Inline/clone-function-no-assert-on-phis.ll
llvm/unittests/IR/BasicBlockTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69865.227934.patch
Type: text/x-patch
Size: 8800 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191105/1e2cf6d9/attachment.bin>
More information about the llvm-commits
mailing list