[PATCH] D138027: Clean up CFG on JumpThreading

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 06:02:26 PST 2022


nikic added a comment.

In D138027#4004728 <https://reviews.llvm.org/D138027#4004728>, @arkangath wrote:

> I am aware that the IR after the transformation is legal (as I mentioned in a previous comment).
>
> In the larger scope of things, LLVm is being used as a compiler toolchain for a commercial project (sorry for being coy, but you know how big corp is... and I'm not particularly happy about it either).
> There is another transform pass being run after JumpThreading which iterates over the blocks on a function, without checking their reachability or checking the CFG. That pass errors beause it finds a self-referencing instruction. Whether that instruction is reachable or not is irrelevant. I suggested to the team to just run CFGSimplify (or CSE I guess), but that has a compile-time cost, and if JumpThreading already knows the blocks are dead, might as well drop them there and then.

Pass correctness cannot depend on their position in the pipeline. If a pass cannot deal with self-referential IR (by skipping unreachable blocks or in some other way), that's a problem with that pass, not whatever produced the IR.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138027/new/

https://reviews.llvm.org/D138027



More information about the llvm-commits mailing list