HomePhabricator

Move folding of icmp with zero after checking for min/max idioms.

Description

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>