[PATCH] D125321: [InstCombine] Freeze other uses of frozen value

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 10 08:53:58 PDT 2022


nikic created this revision.
nikic added reviewers: mtrofin, hyeongyukim, spatel, nlopes.
Herald added a subscriber: hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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 to the nearest common dominator.

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 <https://reviews.llvm.org/D125248>.


https://reviews.llvm.org/D125321

Files:
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/test/Transforms/InstCombine/freeze.ll
  llvm/test/Transforms/InstCombine/onehot_merge.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125321.428396.patch
Type: text/x-patch
Size: 7873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220510/35922a79/attachment.bin>


More information about the llvm-commits mailing list