[PATCH] D138027: Clean up CFG on JumpThreading

Pedro Olsen Ferreira via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 05:45:08 PST 2022


arkangath added a comment.

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.

As for more complicated inputs, I would welcome an example. I thought that JumpThreading would eventually reduce any unreachable CFG into a self-referencing block. Nevertheless, _some_ clean up is better than no clean up?



================
Comment at: llvm/test/Transforms/JumpThreading/self-block.ll:1
+; RUN: opt -S -jump-threading %s -o - | FileCheck %s
+
----------------
lebedev.ri wrote:
> The old result is not a misompile: https://godbolt.org/z/Ecf181P75
> Unreachable code can take many weird forms.
Yes, I am aware. What change is being requested?


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