[PATCH][X86] Prevent the creation of redundant ops for sadd and ssub with overflow.

Juergen Ributzka juergen at apple.com
Thu Jan 23 21:13:35 PST 2014


Hi @ll,
Hi Nadav,

the use of the sadd.with.overflow (ssub.with.overflow) intrinsic on X86 creates suboptimal code. In the X86 backend the intrinsic itself might be lowered to a different X86 specific instruction than the conditional branch that depends on the overflow result. For example a simple loop counter with overflow check would get expanded to two different instructions. The intrinsic lowering would create an INC instruction, because the loop counter is incremented by 1. The conditional branch lowering on the other side wouldn’t optimize for this special case and just emit and ADD instruction. This prevented the SelectionDAG from recognizing and removing one of the redundant additions. This patch simply modifies the conditional branch lowering to generate the same code as the intrinsic lowering for sadd/ssub would do.

Cheers,
Juergen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-X86-Prevent-the-creation-of-redundant-ops-for-sadd-a.patch
Type: application/octet-stream
Size: 3469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140123/e010cef1/attachment.obj>


More information about the llvm-commits mailing list