Add support to indvars for optimizing sadd.with.overflow.
authorAndrew Trick <atrick@apple.com>
Mon, 23 Dec 2013 23:31:49 +0000 (23:31 +0000)
committerAndrew Trick <atrick@apple.com>
Mon, 23 Dec 2013 23:31:49 +0000 (23:31 +0000)
commitc7b0b7dc8f2424057b3a84f7b3eb2f893c24ed57
treec7e6c806e485ddc70e74c4de32272fd52f35b90f
parent7ed2b702a209ba9780529adcf87ab8b7047483d4
Add support to indvars for optimizing sadd.with.overflow.

Split sadd.with.overflow into add + sadd.with.overflow to allow
analysis and optimization. This should ideally be done after
InstCombine, which can perform code motion (eventually indvars should
run after all canonical instcombines). We want ISEL to recombine the
add and the check, at least on x86.

This is currently under an option for reducing live induction
variables: -liv-reduce. The next step is reducing liveness of IVs that
are live out of the overflow check paths. Once the related
optimizations are fully developed, reviewed and tested, I do expect
this to become default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197926 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Transforms/Utils/SimplifyIndVar.h
lib/Transforms/Scalar/IndVarSimplify.cpp
lib/Transforms/Utils/SimplifyIndVar.cpp
test/Transforms/IndVarSimplify/overflowcheck.ll [new file with mode: 0644]