[all-commits] [llvm/llvm-project] 6001bf: [InstCombine] Freeze other uses of frozen value

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed May 11 07:47:29 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6001bfcedc3102b45878b7883c241b45863d7e2c
      https://github.com/llvm/llvm-project/commit/6001bfcedc3102b45878b7883c241b45863d7e2c
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-05-11 (Wed, 11 May 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/freeze.ll
    M llvm/test/Transforms/InstCombine/onehot_merge.ll

  Log Message:
  -----------
  [InstCombine] Freeze other uses of frozen value

If there is a freeze %x, we currently replace all other uses of %x
with freeze %x -- as long as they are dominated by the freeze
instruction. This patch extends this behavior to cases where we
did not originally dominate the use by moving the freeze
instruction directly after the definition of the frozen value.

The motivation can be seen in test @combine_and_after_freezing_uses:
Canonicalizing everything to freeze %x allows folds that are based
on value identity (i.e. same operand occurring in two places) to
trigger. This also covers the case from D125248.

Differential Revision: https://reviews.llvm.org/D125321




More information about the All-commits mailing list