[llvm] 2627f99 - [dfsan] Fix Len argument type in call to __dfsan_mem_transfer_callback
Jianzhou Zhao via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 22 14:13:17 PDT 2021
Author: Elia Geretto
Date: 2021-04-22T21:12:20Z
New Revision: 2627f99613740b8f8a85e150dc0e4c4b6fa6e13f
URL: https://github.com/llvm/llvm-project/commit/2627f99613740b8f8a85e150dc0e4c4b6fa6e13f
DIFF: https://github.com/llvm/llvm-project/commit/2627f99613740b8f8a85e150dc0e4c4b6fa6e13f.diff
LOG: [dfsan] Fix Len argument type in call to __dfsan_mem_transfer_callback
This patch is supposed to solve: https://bugs.llvm.org/show_bug.cgi?id=50075
The function `__dfsan_mem_transfer_callback` takes a `Len` argument of type `i64`; however, when processing a `MemTransferInst` such as `llvm.memcpy.p0i8.p0i8.i32`, the `len` argument has type `i32`. In order to make the type of `len` compatible with the one of the callback argument, this change zero-extends it when necessary.
Reviewed By: stephan.yichao.zhao, gbalats
Differential Revision: https://reviews.llvm.org/D101048
Added:
Modified:
llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
index 19dd41904779..015639dcceb6 100644
--- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -2915,7 +2915,8 @@ void DFSanVisitor::visitMemTransferInst(MemTransferInst &I) {
}
if (ClEventCallbacks) {
IRB.CreateCall(DFSF.DFS.DFSanMemTransferCallbackFn,
- {RawDestShadow, I.getLength()});
+ {RawDestShadow,
+ IRB.CreateZExtOrTrunc(I.getLength(), DFSF.DFS.IntptrTy)});
}
}
More information about the llvm-commits
mailing list