]> granicus.if.org Git - clang/commit
Follow the implementation approach suggested by PR6687,
authorChris Lattner <sabre@nondot.org>
Tue, 20 Jul 2010 21:07:09 +0000 (21:07 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 20 Jul 2010 21:07:09 +0000 (21:07 +0000)
commit83252dcfe61aaebcb6bc117e71dc12968729513f
treea303b42463464aef9a146dbc5678a70d0c0bfe31
parent021a7a63984f0f912dc9e9dae2a1b3e1509a40ce
Follow the implementation approach suggested by PR6687,
which generates more efficient and more obviously conformant
code.  We now test for overflow of the multiply then force
the result to -1 if so.  On X86, this generates nice code
like this:

__Z4testl:                              ## @_Z4testl
## BB#0:                                ## %entry
subl $12, %esp
movl $4, %eax
mull 16(%esp)
testl %edx, %edx
movl $-1, %ecx
cmovel %eax, %ecx
movl %ecx, (%esp)
call __Znam
addl $12, %esp
ret

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108927 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGExprCXX.cpp
lib/CodeGen/CodeGenFunction.cpp
lib/CodeGen/CodeGenFunction.h
test/CodeGenCXX/operator-new.cpp