Skip to content

Commit 0f58cac

Browse files
committed
WIP: disable intercept memove
1 parent d0eb95d commit 0f58cac

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/InlineInstrumentation.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static const size_t kShadowScale = 4;
2525

2626
static Function *MemStoreFn;
2727
static Function *MemLoadFn;
28-
static Function *MemMemmoveFn;
28+
//static Function *MemMemmoveFn;
2929
static Function *MemMemcpyFn;
3030
static Function *MemMemsetFn;
3131

@@ -42,12 +42,12 @@ void initMemFn(Module &M, const std::string NameStore, const std::string NameLo
4242
MemLoadFn = cast<Function>(M.getOrInsertFunction(NameLoad, IRB.getInt64Ty(), IRB.getInt8PtrTy(),
4343
IRB.getInt32Ty(), IRB.getInt32Ty())
4444
);
45-
45+
#if 0
4646
MemMemmoveFn = checkSanitizerInterfaceFunction( M.getOrInsertFunction(NameMemmove,
4747
IRB.getVoidTy(), IRB.getInt8PtrTy(),
4848
IRB.getInt8PtrTy(), IRB.getInt32Ty()
4949
));
50-
50+
#endif
5151
MemMemcpyFn = checkSanitizerInterfaceFunction((M.getOrInsertFunction(NameMemcpy,
5252
IRB.getVoidTy(), IRB.getInt8PtrTy(),
5353
IRB.getInt8PtrTy(), IRB.getInt32Ty())
@@ -61,9 +61,10 @@ void initMemFn(Module &M, const std::string NameStore, const std::string NameLo
6161

6262
bool instrumentMemIntrinsic(MemIntrinsic *MI) {
6363
IRBuilder<> IRB(MI);
64-
if (isa<MemTransferInst>(MI)) {
64+
if (isa<MemTransferInst>(MI) && isa<MemCpyInst>(MI)) {
6565
IRB.CreateCall(
66-
isa<MemMoveInst>(MI) ? MemMemmoveFn : MemMemcpyFn,
66+
MemMemcpyFn,
67+
//isa<MemMoveInst>(MI) ? MemMemmoveFn : MemMemcpyFn,
6768
{IRB.CreatePointerCast(MI->getOperand(0), IRB.getInt8PtrTy(), "dest_i8ptr_"),
6869
IRB.CreatePointerCast(MI->getOperand(1), IRB.getInt8PtrTy(), "src_i8ptr_"),
6970
IRB.CreateIntCast(MI->getOperand(2), IRB.getInt32Ty(), false, "size_int32_")});

test/ir/mem_fn.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ define void @q(i8*) #0 {
2828
; CHECK: call void @__adin_memcpy_(i8* %5, i8* bitcast (%union.SYSCTRL_OSC8M_Type* getelementptr inbounds (%struct.Sysctrl, %struct.Sysctrl* null, i32 0, i32 1) to i8*), i32 4)
2929
; CHECK: call void @__adin_memcpy_(i8* bitcast (%union.SYSCTRL_OSC8M_Type* getelementptr inbounds (%struct.Sysctrl, %struct.Sysctrl* null, i32 0, i32 1) to i8*), i8* %6, i32 4)
3030
; CHECK: call void @__adin_memset_(i8* %7, i8 0, i32 11)
31-
; CHECK: call void @__adin_memmove_(i8* %8, i8* %9, i32 11)
31+
; cHECK: call void @__adin_memmove_(i8* %8, i8* %9, i32 11)
32+
; CHECK: call void @llvm.memmove.p0i8.p0i8.i64(i8* %8, i8* %9, i64 11, i32 1, i1 false)
3233
ret void
3334
}
3435

0 commit comments

Comments
 (0)