enhance x-(-A) -> x+A to preserve NUW/NSW.
authorChris Lattner <sabre@nondot.org>
Mon, 21 Dec 2009 04:04:05 +0000 (04:04 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 21 Dec 2009 04:04:05 +0000 (04:04 +0000)
commit3bf68155563cac6848d671848d875f41ad7e3277
tree396f56075134fb3d58520cdb78c3ccbe58bf6409
parent2799bafb98676c000388f8636d58064f2646266e
enhance x-(-A) -> x+A to preserve NUW/NSW.

Use the presence of NSW/NUW to fold "icmp (x+cst), x" to a constant in
cases where it would otherwise be undefined behavior.

Surprisingly (to me at least), this triggers hundreds of the times in
a few benchmarks: lencode, ldecode, and 466.h264ref seem to *really*
like this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91812 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/InstructionCombining.cpp
test/Transforms/InstCombine/icmp.ll