InstCombine: simplify signed range checks
authorErik Eckstein <eeckstein@apple.com>
Wed, 3 Dec 2014 10:39:15 +0000 (10:39 +0000)
committerErik Eckstein <eeckstein@apple.com>
Wed, 3 Dec 2014 10:39:15 +0000 (10:39 +0000)
commitd181752be0cfe9b5813947c27c857a8ad5e30ba1
tree1d5899f37883f18151ddbb4a11ec9aa95ef96556
parent25383ac01b493a7cf0aa79433c592583c2e44c63
InstCombine: simplify signed range checks

Try to convert two compares of a signed range check into a single unsigned compare.
Examples:
(icmp sge x, 0) & (icmp slt x, n) --> icmp ult x, n
(icmp slt x, 0) | (icmp sgt x, n) --> icmp ugt x, n

llvm-svn: 223224
llvm/lib/Transforms/InstCombine/InstCombine.h
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/range-check.ll [new file with mode: 0644]