From ed9def75db9dbefd6b5a1f877d74fef8cc5fc720 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 5 Mar 2014 19:01:25 -0800 Subject: Don't emit redirects for llvm.memcpy.p0i8.p0i8.i32 and friends. We never reference these intrinsics by name, so we don't need redirects for them. --- lib/Target/JSBackend/CallHandlers.h | 3 --- lib/Target/JSBackend/JSBackend.cpp | 8 -------- test/CodeGen/JS/mem-intrinsics.ll | 14 ++++++++++++++ 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/Target/JSBackend/CallHandlers.h b/lib/Target/JSBackend/CallHandlers.h index 7a2bf4bb86..0aeac3a770 100644 --- a/lib/Target/JSBackend/CallHandlers.h +++ b/lib/Target/JSBackend/CallHandlers.h @@ -298,7 +298,6 @@ DEF_CALL_HANDLER(llvm_memcpy_p0i8_p0i8_i32, { } } Declares.insert("memcpy"); - Redirects["llvm_memcpy_p0i8_p0i8_i32"] = "memcpy"; return CH___default__(CI, "_memcpy", 3) + "|0"; }) @@ -354,13 +353,11 @@ DEF_CALL_HANDLER(llvm_memset_p0i8_i32, { } } Declares.insert("memset"); - Redirects["llvm_memset_p0i8_i32"] = "memset"; return CH___default__(CI, "_memset", 3) + "|0"; }) DEF_CALL_HANDLER(llvm_memmove_p0i8_p0i8_i32, { Declares.insert("memmove"); - Redirects["llvm_memmove_p0i8_p0i8_i32"] = "memmove"; return CH___default__(CI, "_memmove", 3) + "|0"; }) diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp index 9d10988449..e878db325c 100644 --- a/lib/Target/JSBackend/JSBackend.cpp +++ b/lib/Target/JSBackend/JSBackend.cpp @@ -262,14 +262,6 @@ namespace { } else return 'i'; } std::string getFunctionSignature(const FunctionType *F, const std::string *Name=NULL) { - if (Name) { - // special-case some function signatures, because of how we emit code for them FIXME this is hackish - if (*Name == "_llvm_memcpy_p0i8_p0i8_i32" || *Name == "_memcpy" || - *Name == "_llvm_memset_p0i8_i32" || *Name == "_memset" || - *Name == "_llvm_memmove_p0i8_p0i8_i32" || *Name == "_memmove") { - return "iiii"; - } - } std::string Ret; Ret += getFunctionSignatureLetter(F->getReturnType()); for (FunctionType::param_iterator AI = F->param_begin(), diff --git a/test/CodeGen/JS/mem-intrinsics.ll b/test/CodeGen/JS/mem-intrinsics.ll index 52b13f3336..995d70d535 100644 --- a/test/CodeGen/JS/mem-intrinsics.ll +++ b/test/CodeGen/JS/mem-intrinsics.ll @@ -16,6 +16,13 @@ define void @test_loop_memcpy(i8* %d, i8* %s) { ret void } +; CHECK: test_call_memcpy +; CHECK: memcpy(($d|0),($s|0),65536) +define void @test_call_memcpy(i8* %d, i8* %s) { + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %d, i8* %s, i32 65536, i32 4, i1 false) + ret void +} + ; CHECK: test_unrolled_memset ; CHECK: HEAP32[$d+0>>2]=0|0;HEAP32[$d+4>>2]=0|0;HEAP32[$d+8>>2]=0|0;HEAP32[$d+12>>2]=0|0;HEAP32[$d+16>>2]=0|0;HEAP32[$d+20>>2]=0|0;HEAP32[$d+24>>2]=0|0;HEAP32[$d+28>>2]=0|0; define void @test_unrolled_memset(i8* %d, i8* %s) { @@ -30,6 +37,13 @@ define void @test_loop_memset(i8* %d, i8* %s) { ret void } +; CHECK: test_call_memset +; CHECK: memset(($d|0),0,65536) +define void @test_call_memset(i8* %d, i8* %s) { + call void @llvm.memset.p0i8.i32(i8* %d, i8 0, i32 65536, i32 4, i1 false) + ret void +} + ; Also, don't emit declarations for the intrinsic functions. ; CHECK-NOT: p0i8 -- cgit v1.2.3-18-g5258