X86: peephole optimization to remove cmp instruction
authorManman Ren <mren@apple.com>
Fri, 1 Jun 2012 19:49:33 +0000 (19:49 +0000)
committerManman Ren <mren@apple.com>
Fri, 1 Jun 2012 19:49:33 +0000 (19:49 +0000)
commit73c2f7f5ed767a6fc062fd198551be902b7b7d5b
tree0e7ddc57a166cd5f076eac14c404412061d88d0f
parent68f25571e759c1fcf2da206109647259f49f7416
X86: peephole optimization to remove cmp instruction

This patch will optimize the following:
  sub r1, r3
  cmp r3, r1 or cmp r1, r3
  bge L1
TO
  sub r1, r3
  bge L1 or ble L1

If the branch instruction can use flag from "sub", then we can eliminate
the "cmp" instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157831 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86InstrArithmetic.td
lib/Target/X86/X86InstrInfo.cpp
lib/Target/X86/X86InstrInfo.h
test/CodeGen/X86/jump_sign.ll