[all-commits] [llvm/llvm-project] f8f696: [InstCombine] Allow freezing multiple operands (#1...

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Aug 25 03:59:00 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f8f6965ceece9e330ddb66db5f402ecfb5e3ad34
      https://github.com/llvm/llvm-project/commit/f8f6965ceece9e330ddb66db5f402ecfb5e3ad34
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2025-08-25 (Mon, 25 Aug 2025)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/freeze-fp-ops.ll
    M llvm/test/Transforms/InstCombine/freeze.ll
    M llvm/test/Transforms/InstCombine/icmp.ll
    M llvm/test/Transforms/InstCombine/nsw.ll
    M llvm/test/Transforms/InstCombine/select.ll
    M llvm/test/Transforms/InstCombine/sub-of-negatible-inseltpoison.ll
    M llvm/test/Transforms/InstCombine/sub-of-negatible.ll
    M llvm/test/Transforms/InstCombine/urem-via-cmp-select.ll
    M llvm/test/Transforms/LoopVectorize/forked-pointers.ll
    M llvm/test/Transforms/PGOProfile/chr.ll
    M llvm/test/Transforms/PhaseOrdering/X86/vector-reductions-logical.ll

  Log Message:
  -----------
  [InstCombine] Allow freezing multiple operands (#154336)

InstCombine tries to convert `freeze(inst(op))` to `inst(freeze(op))`.
Currently, this is limited to the case where a single operand needs to
be frozen, and all other operands are guaranteed non-poison.

This patch allows the transform even if multiple operands need to be
frozen. The existing limitation makes sure that we do not increase the
total number of freezes, but it also means that that we may fail to
eliminate freezes (via poison flag dropping) and may prevent
optimizations (as analysis generally can't look past freeze). Overall, I
believe that aggressively pushing freezes upwards is more beneficial
than harmful.

This is the middle-end version of #145939 in DAGCombine (which is
currently reverted for SDAG-specific reasons).



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