summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InferFunctionAttrs/annotate.ll
diff options
context:
space:
mode:
authorClement Courbet <courbet@google.com>2019-03-08 09:07:45 +0000
committerClement Courbet <courbet@google.com>2019-03-08 09:07:45 +0000
commit8e16d73346f8091461319a7dfc4ddd18eedcff13 (patch)
tree834ddc2069d1bcdb9214a794b89c7570156a6046 /llvm/test/Transforms/InferFunctionAttrs/annotate.ll
parent1a98dc184044768dd672c54b3b9557a05dd082f1 (diff)
downloadbcm5719-llvm-8e16d73346f8091461319a7dfc4ddd18eedcff13.tar.gz
bcm5719-llvm-8e16d73346f8091461319a7dfc4ddd18eedcff13.zip
[SelectionDAG] Allow the user to specify a memeq function.
Summary: Right now, when we encounter a string equality check, e.g. `if (memcmp(a, b, s) == 0)`, we try to expand to a comparison if `s` is a small compile-time constant, and fall back on calling `memcmp()` else. This is sub-optimal because memcmp has to compute much more than equality. This patch replaces `memcmp(a, b, s) == 0` by `bcmp(a, b, s) == 0` on platforms that support `bcmp`. `bcmp` can be made much more efficient than `memcmp` because equality compare is trivially parallel while lexicographic ordering has a chain dependency. Subscribers: fedor.sergeev, jyknight, ckennelly, gchatelet, llvm-commits Differential Revision: https://reviews.llvm.org/D56593 llvm-svn: 355672
Diffstat (limited to 'llvm/test/Transforms/InferFunctionAttrs/annotate.ll')
-rw-r--r--llvm/test/Transforms/InferFunctionAttrs/annotate.ll9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/test/Transforms/InferFunctionAttrs/annotate.ll b/llvm/test/Transforms/InferFunctionAttrs/annotate.ll
index 161873be56e..02278161345 100644
--- a/llvm/test/Transforms/InferFunctionAttrs/annotate.ll
+++ b/llvm/test/Transforms/InferFunctionAttrs/annotate.ll
@@ -1,5 +1,5 @@
-; RUN: opt < %s -mtriple=x86_64-- -inferattrs -S | FileCheck %s
-; RUN: opt < %s -mtriple=x86_64-- -passes=inferattrs -S | FileCheck %s
+; RUN: opt < %s -mtriple=x86_64-- -inferattrs -S | FileCheck -check-prefix=CHECK-UNKNOWN %s
+; RUN: opt < %s -mtriple=x86_64-- -passes=inferattrs -S | FileCheck -check-prefix=CHECK-UNKNOWN %s
; RUN: opt < %s -mtriple=x86_64-apple-macosx10.8.0 -inferattrs -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-DARWIN %s
; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -inferattrs -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-LINUX %s
; RUN: opt < %s -mtriple=nvptx -inferattrs -S | FileCheck -check-prefix=CHECK-NVPTX %s
@@ -241,7 +241,10 @@ declare i64 @atol(i8*)
; CHECK: declare i64 @atoll(i8* nocapture) [[G1]]
declare i64 @atoll(i8*)
-; CHECK: declare i32 @bcmp(i8* nocapture, i8* nocapture, i64) [[G1]]
+; CHECK-DARWIN: declare i32 @bcmp(i8* nocapture, i8* nocapture, i64) [[G1]]
+; CHECK-LINUX: declare i32 @bcmp(i8* nocapture, i8* nocapture, i64) [[G1]]
+; CHECK-UNKNOWN-NOT: declare i32 @bcmp(i8* nocapture, i8* nocapture, i64) [[G1]]
+; CHECK-NVPTX-NOT: declare i32 @bcmp(i8* nocapture, i8* nocapture, i64) [[G1]]
declare i32 @bcmp(i8*, i8*, i64)
; CHECK: declare void @bcopy(i8* nocapture readonly, i8* nocapture, i64) [[G0]]
OpenPOWER on IntegriCloud