[InstCombine] Fold icmp ugt/ult (add nuw X, C2), C --> icmp ugt/ult X, (C - C2)
authorNicola Zaghen <nicola.zaghen@imgtec.com>
Tue, 4 Sep 2018 10:29:48 +0000 (10:29 +0000)
committerNicola Zaghen <nicola.zaghen@imgtec.com>
Tue, 4 Sep 2018 10:29:48 +0000 (10:29 +0000)
commit9588ad9611368d65a6f619ae5e79fff70854a1fc
treef51068c83cdebf1b82bf5bdfd2512383917f2fb0
parentef16ea7f7ade8dbe3647e7c829a13d1dbeee0f0e
[InstCombine] Fold icmp ugt/ult (add nuw X, C2), C --> icmp ugt/ult X, (C - C2)

Support for sgt/slt was added in rL294898, this adds the same cases also for unsigned compares.

This is the Alive proof: https://rise4fun.com/Alive/nyY

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

llvm-svn: 341353
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Analysis/ValueTracking/non-negative-phi-bits.ll
llvm/test/Transforms/InstCombine/icmp-add.ll
llvm/test/Transforms/LoopVectorize/X86/masked_load_store.ll
llvm/test/Transforms/LoopVectorize/if-conversion-nest.ll
llvm/test/Transforms/LoopVectorize/runtime-check.ll