[all-commits] [llvm/llvm-project] a64408: Revert "[StructurizeCFG] Refactor insertConditions...

Shilei Tian via All-commits all-commits at lists.llvm.org
Fri Apr 18 14:27:32 PDT 2025


  Branch: refs/heads/users/shiltian/structurize-cfg-fix
  Home:   https://github.com/llvm/llvm-project
  Commit: a644088a753cf893e57eb817b5fdc7de79b72154
      https://github.com/llvm/llvm-project/commit/a644088a753cf893e57eb817b5fdc7de79b72154
  Author: Shilei Tian <i at tianshilei.me>
  Date:   2025-04-18 (Fri, 18 Apr 2025)

  Changed paths:
    M llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
    M llvm/test/Transforms/StructurizeCFG/simple-structurizecfg-crash.ll

  Log Message:
  -----------
  Revert "[StructurizeCFG] Refactor insertConditions. NFC. (#115476)"

This reverts commit `231e63d8162a1c78a973c6e546bea39d04fefd67` because it was
intended to be NFC, but it actually introduces a semantic change. The behavior
is not equivalent to the original code.

Specifically, the change attempts to make the special case of `Parent` being the
only predecessor more explicit by isolating it, and then asserts in the `else`
branch that `BB` can't be `Parent`. However, it's still possible for
`Preds.size() > 1`, in which case `BB` can be `Parent`, causing the assertion to
trigger.

Eventually, this introduced a regression (though the related test case wasn't in
the repo at the time). To fix it properly, we'd have to reintroduce logic in the
`else` block to handle the case where `BB` is `Parent`, which counters the
intent of the original refactor. Because of that, I think it's cleaner and more
reliable to simply revert the commit.

Fixes #126534.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list