[all-commits] [llvm/llvm-project] c6b88c: [InstCombine] Push freeze through recurrence phi
Nikita Popov via All-commits
all-commits at lists.llvm.org
Fri Jun 17 06:03:24 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c6b88cb9184fc6c17bb3d9c2c9568646dc46638d
https://github.com/llvm/llvm-project/commit/c6b88cb9184fc6c17bb3d9c2c9568646dc46638d
Author: Nikita Popov <npopov at redhat.com>
Date: 2022-06-17 (Fri, 17 Jun 2022)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
M llvm/test/Transforms/InstCombine/freeze.ll
Log Message:
-----------
[InstCombine] Push freeze through recurrence phi
We really want to push freezes through recurrence phis, so that we
freeze only the start value, rather than the IV value on every
iteration. foldOpIntoPhi() already handles this for the case where
the transfer function doesn't produce poison, e.g.
%iv.next = add %iv, 1. However, this does not work if nowrap flags
are present, e.g. the very common %iv.next = add nuw %iv, 1 case.
This patch adds a fold that pushes freeze instructions to the start
value by checking whether all backedge values will be non-poison
after poison generating flags have been dropped. This allows pushing
freezes out of loops in most cases. I suspect that this also
obsoletes the CanonicalizeFreezeInLoops pass, and we can probably
drop it.
Fixes https://github.com/llvm/llvm-project/issues/56048.
Differential Revision: https://reviews.llvm.org/D127960
More information about the All-commits
mailing list