[PATCH] D69865: [IR] PR27065: Part2. Fix BasicBlock::removePredecessor to not break SSA form.
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 7 05:23:33 PST 2019
spatel added a comment.
In D69865#1736308 <https://reviews.llvm.org/D69865#1736308>, @jdoerfert wrote:
> In D69865#1736296 <https://reviews.llvm.org/D69865#1736296>, @dendibakh wrote:
>
> > In D69865#1736280 <https://reviews.llvm.org/D69865#1736280>, @jdoerfert wrote:
> >
> > > Unreachable code is generally allowed to be in non-SSA form.
> >
> >
> > Is it documented somewhere?
>
>
> Probably is, I don't have a reference handy though.
>
> > I think it adds certain limitations to the usage of some LLVM functionality. For example, if someone decide to link in detached blocks (after removePredecessor) again, (s)he will be surprised to find broken SSA code in there. It limits room for hacking certainly.
>
> While that is not untrue, there is a very simple solution: run trivial dead code removal first. What you are trying to do, prevent generation of degenerated unreachable IR, is an uphill battle on more fronts than you would imagine.
A same/similar question about this code in BasicBlock was raised on llvm-dev here:
http://lists.llvm.org/pipermail/llvm-dev/2015-August/089091.html
Unfortunately, I don't think the legality of the invalid SSA is documented anywhere. But as we can see, it passes the IR verifier.
As noted in D69823 <https://reviews.llvm.org/D69823>, I've made several patches to other passes to work-around the issue. It would be great if we didn't have to do that, but AFAIK, we're stuck.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69865/new/
https://reviews.llvm.org/D69865
More information about the llvm-commits
mailing list