From 49cddb90f6455d850fcee7d7cd5b414531e3422f Mon Sep 17 00:00:00 2001 From: =?utf8?q?D=C3=A1vid=20Bolvansk=C3=BD?= Date: Wed, 28 Oct 2020 21:23:13 +0100 Subject: [PATCH] [MemLoc] Adjust memccpy support in MemoryLocation::getForArgument Use LocationSize::upperBound instead of precise since we only know an upper bound on the number of bytes read/written. Reviewed By: fhahn Differential Revision: https://reviews.llvm.org/D89885 --- llvm/lib/Analysis/MemoryLocation.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Analysis/MemoryLocation.cpp b/llvm/lib/Analysis/MemoryLocation.cpp index 4c1395c..8d58679 100644 --- a/llvm/lib/Analysis/MemoryLocation.cpp +++ b/llvm/lib/Analysis/MemoryLocation.cpp @@ -257,10 +257,11 @@ MemoryLocation MemoryLocation::getForArgument(const CallBase *Call, case LibFunc_memccpy: assert((ArgIdx == 0 || ArgIdx == 1) && "Invalid argument index for memccpy"); + // We only know an upper bound on the number of bytes read/written. if (const ConstantInt *LenCI = dyn_cast(Call->getArgOperand(3))) - return MemoryLocation(Arg, LocationSize::precise(LenCI->getZExtValue()), - AATags); + return MemoryLocation( + Arg, LocationSize::upperBound(LenCI->getZExtValue()), AATags); break; default: break; -- 2.7.4