[InstSimplify] Fold icmp with dominating assume
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 28 Jun 2020 13:59:56 +0000 (15:59 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 3 Jul 2020 16:53:58 +0000 (18:53 +0200)
commitcf1d9f9f49ae62ab4c7bb685d786a8daa7bc1d4a
treea7e59faba40554619c5a0180ab995b4d076afca9
parent6fa1343bb3e8a59116cdafc4186c85d6c6ce12df
[InstSimplify] Fold icmp with dominating assume

If we assume(x > y), then we should be able to fold the basic
implications of that, like x >= y. This already happens if either
one of the operands is constant (LVI) or if the conditions are
exactly the same (GVN), but not if we have an implication with
non-constant operands. Support this by querying AssumptionCache.

Fixes https://bugs.llvm.org/show_bug.cgi?id=40149.

Differential Revision: https://reviews.llvm.org/D82717
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstSimplify/assume_icmp.ll