[all-commits] [llvm/llvm-project] a4772c: Revert "[SimplifyCFG] Thread branches on same cond...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Jul 5 07:58:03 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a4772cbaf0dc717ab6b4639272ca2910897613f0
      https://github.com/llvm/llvm-project/commit/a4772cbaf0dc717ab6b4639272ca2910897613f0
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-07-05 (Tue, 05 Jul 2022)

  Changed paths:
    M clang/test/CodeGenObjC/exceptions.m
    M clang/test/CodeGenObjCXX/exceptions-legacy.mm
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/CodeGen/AArch64/arm64-andCmpBrToTBZ.ll
    M llvm/test/Transforms/GVNSink/sink-common-code.ll
    M llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll
    M llvm/test/Transforms/SimplifyCFG/jump-threading.ll
    M llvm/test/Transforms/SimplifyCFG/pr55765.ll
    M llvm/test/Transforms/SimplifyCFG/wc-widen-block.ll

  Log Message:
  -----------
  Revert "[SimplifyCFG] Thread branches on same condition in more cases (PR54980)"

This reverts commit 4e545bdb355a470d601e9bb7f7b2693c99e61a3e.

The newly added test is the third infinite combine loop caused by
this change. In this case, it's a combination of the branch to
common dest and jump threading folds that keeps peeling off loop
iterations.

The core problem here is that we ideally would not thread over
loop backedges, both because it is potentially non-profitable
(it may break canonical loop structure) and because it may result
in these kinds of loops. Unfortunately, due to the lack of a
dominator tree in SimplifyCFG, there is no good way to prevent
this. While we have LoopHeaders, this is an optional structure and
we don't do a good job of keeping it up to date. It would be fine
for a profitability check, but is not suitable for a correctness
check.

So for now I'm just giving up here, as I don't see a good way to
robustly prevent infinite combine loops.

Fixes https://github.com/llvm/llvm-project/issues/56203.




More information about the All-commits mailing list