[InstSimplify] Simplify bool icmp with not in LHS
authorHasyimi Bahrudin <hasyimi@gatech.edu>
Thu, 9 Dec 2021 17:03:59 +0000 (12:03 -0500)
committerSanjay Patel <spatel@rotateright.com>
Thu, 9 Dec 2021 21:26:46 +0000 (16:26 -0500)
commitc1cd698a5228ef687641fdf34742dec80a08e085
tree5de66e95c4950ad0e3f79942c08932fde2066bfa
parente3a58dd0308c650df2a04a08eea2f6741c335230
[InstSimplify] Simplify bool icmp with not in LHS

Refer to https://llvm.org/PR52546.

Simplifies the following cases:
    not(X) == 0 -> X != 0 -> X
    not(X) <=u 0 -> X >u 0 -> X
    not(X) >=s 0 -> X <s 0 -> X
    not(X) != 1 -> X == 1 -> X
    not(X) <=u 1 -> X >=u 1 -> X
    not(X) >s 1 -> X <=s -1 -> X

Differential Revision: https://reviews.llvm.org/D114666
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstSimplify/icmp-not-bool-constant.ll