aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <sunfish@mozilla.com>2014-03-05 18:59:40 -0800
committerDan Gohman <sunfish@mozilla.com>2014-03-05 19:00:42 -0800
commit0dfc8b303cac8e56b1dec466627462d24dbacb78 (patch)
tree3bb5199f37f89a5c5e8f9d8b62fb96723a14f606
parent95cd3de38a4d21056e90608b8553e1fda1363c12 (diff)
Don't emit JS declarations for LLVM intrinsics expanded inline.
-rw-r--r--lib/Target/JSBackend/JSBackend.cpp9
-rw-r--r--test/CodeGen/JS/mem-intrinsics.ll3
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp
index f9f3633bcd..9d10988449 100644
--- a/lib/Target/JSBackend/JSBackend.cpp
+++ b/lib/Target/JSBackend/JSBackend.cpp
@@ -1919,8 +1919,8 @@ void JSWriter::printModuleBody() {
for (Module::const_iterator I = TheModule->begin(), E = TheModule->end();
I != E; ++I) {
if (I->isDeclaration() && !I->use_empty()) {
- // Ignore intrinsics that are always no-ops. We don't emit any code for
- // them, so we don't need to declare them.
+ // Ignore intrinsics that are always no-ops or expanded into other code
+ // which doesn't require the intrinsic function itself to be declared.
if (I->isIntrinsic()) {
switch (I->getIntrinsicID()) {
case Intrinsic::dbg_declare:
@@ -1930,6 +1930,11 @@ void JSWriter::printModuleBody() {
case Intrinsic::invariant_start:
case Intrinsic::invariant_end:
case Intrinsic::prefetch:
+ case Intrinsic::memcpy:
+ case Intrinsic::memset:
+ case Intrinsic::memmove:
+ case Intrinsic::expect:
+ case Intrinsic::flt_rounds:
continue;
}
}
diff --git a/test/CodeGen/JS/mem-intrinsics.ll b/test/CodeGen/JS/mem-intrinsics.ll
index 2fb834beaa..52b13f3336 100644
--- a/test/CodeGen/JS/mem-intrinsics.ll
+++ b/test/CodeGen/JS/mem-intrinsics.ll
@@ -30,6 +30,9 @@ define void @test_loop_memset(i8* %d, i8* %s) {
ret void
}
+; Also, don't emit declarations for the intrinsic functions.
+; CHECK-NOT: p0i8
+
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) #0
declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) #0