[all-commits] [llvm/llvm-project] 6f3483: [instcombine] propagate freeze through single use ...
Philip Reames via All-commits
all-commits at lists.llvm.org
Tue Oct 12 13:53:03 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6f348394079f8baa8f33bf68a50457c108e2305f
https://github.com/llvm/llvm-project/commit/6f348394079f8baa8f33bf68a50457c108e2305f
Author: Philip Reames <listmail at philipreames.com>
Date: 2021-10-12 (Tue, 12 Oct 2021)
Changed paths:
M llvm/include/llvm/Analysis/ValueTracking.h
M llvm/lib/Analysis/ValueTracking.cpp
M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
M llvm/test/Transforms/InstCombine/freeze.ll
Log Message:
-----------
[instcombine] propagate freeze through single use poison producing flag instruction
If we have an instruction which produces poison only when flags are specified on the instruction, then we know that freezing the operands and dropping flags is equivalent to freezing the result. If we know those flags don't result in any undefined behavior being executed, then there's no point in preserving the flags as we gain no knowledge by having them.
This patch extends the existing propagation logic which sinks freeze to single potential non-poison operands to allow dropping of flags when we know the freeze is the sole use of the instruction with poison flags.
The main value is that we tend to sink freezes towards the phi in IV cycles where the incoming value to the phi is the freeze of an IV increment. This will in turn (in a future patch), let us fold the freeze through the phi into the loop preheader. Motivated by eliminating need for CanonicalizeFreezeInLoops for the clearly profitable cases from onephi.ll test case in the test directory.
Differential Revision: https://reviews.llvm.org/D111675
More information about the All-commits
mailing list