[all-commits] [llvm/llvm-project] 3bc38f: [InstCombine] Generalize and consolidate phi trans...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Sep 4 07:23:04 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3bc38fb27a12f785d8e78b8d00cbd277464ace92
      https://github.com/llvm/llvm-project/commit/3bc38fb27a12f785d8e78b8d00cbd277464ace92
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-09-04 (Wed, 04 Sep 2024)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/phi-select-constant.ll

  Log Message:
  -----------
  [InstCombine] Generalize and consolidate phi translation check (#106051)

The foldOpIntoPhi() transforms requires all operands to be
phi-translatable. This can be the case either because they are phi nodes
in the same block, or because the operand dominates the block.

Currently, most callers of foldOpIntoPhi() satisfy this pre-condition by
requiring a constant operand, which trivially dominates everything. Only
selects had handling for variable operands.

Move this logic into foldOpIntoPhi(), so things are handled correctly if
other callers are generalized. Also make the implementation a bit more
general by querying the dominator tree.



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