[all-commits] [llvm/llvm-project] 6b05f4: [InstCombine] Fix bail-out in `PHIsEqualValue()`

Mingjie Xu via All-commits all-commits at lists.llvm.org
Thu Dec 4 04:19:01 PST 2025


  Branch: refs/heads/users/Enna1/PHIsEqualValue-bail-out
  Home:   https://github.com/llvm/llvm-project
  Commit: 6b05f47fe97c2041a4c41648b31580225f736150
      https://github.com/llvm/llvm-project/commit/6b05f47fe97c2041a4c41648b31580225f736150
  Author: xumingjie.enna1 <xumingjie.enna1 at bytedance.com>
  Date:   2025-12-04 (Thu, 04 Dec 2025)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp

  Log Message:
  -----------
  [InstCombine] Fix bail-out in `PHIsEqualValue()`

We encountered a such case: `PHIsEqualValue()` is called with a PHI node `PN`
whose incoming values are all PHI nodes, and `NonPhiInVal` is nullptr.
When the size of `ValueEqualPHIs` reaches 16, `NonPhiInVal` is still nullptr,
then we keep scanning PHI node operands, this time the recursion won't bail
out even if we have visited too many PHI nodes.

In our case, the recursion ends with ~1700 PHI nodes visited, causes
InstCombine time-consuming.



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