]> granicus.if.org Git - llvm/commit
Move folding of icmp with zero after checking for min/max idioms.
authorNikolai Bozhenov <nikolai.bozhenov@intel.com>
Mon, 16 Oct 2017 09:19:21 +0000 (09:19 +0000)
committerNikolai Bozhenov <nikolai.bozhenov@intel.com>
Mon, 16 Oct 2017 09:19:21 +0000 (09:19 +0000)
commitefa58149ae688aa73d8faf8f6de608f50349d392
tree41617d00a12b9808f4014f493b727f765e787bf5
parent74cc2953c08f3248077ac5576ce3660c7ae9d0c9
Move folding of icmp with zero after checking for min/max idioms.

Summary:
The following transformation for cmp instruction:

  icmp smin(x, PositiveValue), 0 -> icmp x, 0

should only be done after checking for min/max to prevent infinite
looping caused by a reverse canonicalization. That is why this
transformation was moved to place after the mentioned check.

Reviewers: spatel, efriedma

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D38934

Patch by: Artur Gainullin <artur.gainullin@intel.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315895 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCompares.cpp
lib/Transforms/InstCombine/InstCombineInternal.h
test/Transforms/InstCombine/minmax-fold.ll