[X86] Avoid emitting unnecessary test instructions.
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Mon, 9 Jun 2014 12:34:50 +0000 (12:34 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Mon, 9 Jun 2014 12:34:50 +0000 (12:34 +0000)
commit592d439efee50c81b44285ea718c881281320ce0
tree2a04d50e5296e9e93279594b19751f0e06c587dc
parentbc72c8f0d8dbab5e1ce748cc390254a06e9a5c0a
[X86] Avoid emitting unnecessary test instructions.

This patch teaches the backend how to check for the 'NoSignedWrap' flag on
binary operations to improve the emission of 'test' instructions.

If the result of a binary operation is known not to overflow we know that
resetting the Overflow flag is unnecessary and so we can avoid emitting
the test instruction.

Patch by Marcello Maggioni.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210468 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/2014-05-29-factorial.ll [new file with mode: 0644]