summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/operator-new.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-07-20 21:07:09 +0000
committerChris Lattner <sabre@nondot.org>2010-07-20 21:07:09 +0000
commitf2f387018903c5f0c8ec0c655392454be83f43ed (patch)
tree50bafd9ad6d2995d1362181680b87fe018ca6027 /clang/test/CodeGenCXX/operator-new.cpp
parentbb610d90535bddf87dc4d9b90c695e9c0add69d3 (diff)
downloadbcm5719-llvm-f2f387018903c5f0c8ec0c655392454be83f43ed.tar.gz
bcm5719-llvm-f2f387018903c5f0c8ec0c655392454be83f43ed.zip
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 llvm-svn: 108927
Diffstat (limited to 'clang/test/CodeGenCXX/operator-new.cpp')
-rw-r--r--clang/test/CodeGenCXX/operator-new.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/test/CodeGenCXX/operator-new.cpp b/clang/test/CodeGenCXX/operator-new.cpp
index f5cb2fb6c5d..b108d27ab92 100644
--- a/clang/test/CodeGenCXX/operator-new.cpp
+++ b/clang/test/CodeGenCXX/operator-new.cpp
@@ -23,9 +23,8 @@ void *f2(long N) {
// SANE: call{{.*}}@llvm.umul.with.overflow
// SANE: extractvalue
-// SANE: br i1{{.*}}, label %throw_length_error, label %no_overflow
+// SANE: br i1{{.*}}, label %overflow, label %no_overflow
-// SANE: throw_length_error:
-// SANE: call void @_ZSt20__throw_length_errorPKc
-// SANE: unreachable
+// SANE: = phi {{.*}} [ {{.*}}, %entry ], [ -1, %overflow ]
+// SANE: call noalias i8* @_Znaj(
}
OpenPOWER on IntegriCloud