[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
This commit is contained in:
Dávid Bolvanský 2020-10-28 21:23:13 +01:00
parent 7a996027b9
commit 49cddb90f6
1 changed files with 3 additions and 2 deletions

View File

@ -257,10 +257,11 @@ MemoryLocation MemoryLocation::getForArgument(const CallBase *Call,
case LibFunc_memccpy: case LibFunc_memccpy:
assert((ArgIdx == 0 || ArgIdx == 1) && assert((ArgIdx == 0 || ArgIdx == 1) &&
"Invalid argument index for memccpy"); "Invalid argument index for memccpy");
// We only know an upper bound on the number of bytes read/written.
if (const ConstantInt *LenCI = if (const ConstantInt *LenCI =
dyn_cast<ConstantInt>(Call->getArgOperand(3))) dyn_cast<ConstantInt>(Call->getArgOperand(3)))
return MemoryLocation(Arg, LocationSize::precise(LenCI->getZExtValue()), return MemoryLocation(
AATags); Arg, LocationSize::upperBound(LenCI->getZExtValue()), AATags);
break; break;
default: default:
break; break;