[llvm] 49cddb9 - [MemLoc] Adjust memccpy support in MemoryLocation::getForArgument

Dávid Bolvanský via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 13:26:31 PDT 2020


Author: Dávid Bolvanský
Date: 2020-10-28T21:26:10+01:00
New Revision: 49cddb90f6455d850fcee7d7cd5b414531e3422f

URL: https://github.com/llvm/llvm-project/commit/49cddb90f6455d850fcee7d7cd5b414531e3422f
DIFF: https://github.com/llvm/llvm-project/commit/49cddb90f6455d850fcee7d7cd5b414531e3422f.diff

LOG: [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

Added: 
    

Modified: 
    llvm/lib/Analysis/MemoryLocation.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/MemoryLocation.cpp b/llvm/lib/Analysis/MemoryLocation.cpp
index 4c1395c0f9f6..8d58679dd42b 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<ConstantInt>(Call->getArgOperand(3)))
-        return MemoryLocation(Arg, LocationSize::precise(LenCI->getZExtValue()),
-                              AATags);
+        return MemoryLocation(
+            Arg, LocationSize::upperBound(LenCI->getZExtValue()), AATags);
       break;
     default:
       break;


        


More information about the llvm-commits mailing list