[CodeGenPrepare] Fold br(freeze(icmp x, const)) to br(icmp(freeze x, const))
authorJuneyoung Lee <aqjune@gmail.com>
Mon, 9 Mar 2020 16:37:36 +0000 (01:37 +0900)
committerJuneyoung Lee <aqjune@gmail.com>
Wed, 11 Mar 2020 18:16:15 +0000 (03:16 +0900)
commit8eb2f865c3034934231b1fb3471960191a6f754f
tree157eb4c733cdf460f8e61bd4a3356497055661dc
parented77efeff18c0c894c51d246a2e81b565ec71af9
[CodeGenPrepare] Fold br(freeze(icmp x, const)) to br(icmp(freeze x, const))

Summary:
This patch helps CodeGenPrepare move freeze into the icmp when it is used by branch.
It reenables generation of efficient conditional jumps.

This is only done when at least one of icmp's operands is constant to prevent the transformation from increasing # of freeze instructions.

Performance degradation of MultiSource/Benchmarks/Ptrdist/yacr2/yacr2.test is resolved with this patch.

Checked with Alive2

Reviewers: reames, fhahn, nlopes

Reviewed By: reames

Subscribers: jdoerfert, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D75859
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/test/Transforms/CodeGenPrepare/X86/freeze-icmp.ll [new file with mode: 0644]