[DAGCombiner] Fold SETCC(FREEZE(x),const) to FREEZE(SETCC(x,const)) if SETCC is used...
authorJuneyoung Lee <aqjune@gmail.com>
Fri, 2 Jul 2021 12:00:43 +0000 (21:00 +0900)
committerJuneyoung Lee <aqjune@gmail.com>
Wed, 28 Jul 2021 00:22:15 +0000 (09:22 +0900)
commit4f71f59bf3d9914188a11d0c41bedbb339d36ff5
treeed1067264073a14231db2261065a7f07c237360d
parent784f258c0970ec978dc761e390b32cc2ef84d29d
[DAGCombiner] Fold SETCC(FREEZE(x),const) to FREEZE(SETCC(x,const)) if SETCC is used by BRCOND

This patch adds a peephole optimization `SETCC(FREEZE(x),const)` => `FREEZE(SETCC(x,const))`
if the SETCC is only used by BRCOND.

Combined with `BRCOND(FREEZE(X)) => BRCOND(X)`, this leads to a nice improvement in the generated assembly when x is a masked loaded value.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D105344
llvm/include/llvm/CodeGen/SelectionDAGNodes.h
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/setcc-freeze.ll