[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)
commitdfbdc71ea1bf22c72422afa97948df90bc0a0eb2
treefddaf28a0d768e767158a412d8f33df5501997f4
parent4db1abea150d7cfdbb7f4f402103f3d84d27ba28
[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.

llvm-svn: 210468
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/2014-05-29-factorial.ll [new file with mode: 0644]