diff options
-rw-r--r-- | lib/Target/JSBackend/JSBackend.cpp | 9 | ||||
-rw-r--r-- | test/CodeGen/JS/mem-intrinsics.ll | 3 |
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 |