diff options
author | Nikita Popov <npopov@redhat.com> | 2021-12-18 09:11:33 +0100 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2021-12-18 09:23:41 +0100 |
commit | 1ba99eaf70951a4aa062688577047d8a23bfe54c (patch) | |
tree | cdc1b21d0904fc4d1f74b5bb3462b2bda82274ed /llvm/lib/Analysis/MemoryLocation.cpp | |
parent | 3aae04c744b03eb3eec7376f9d34fa3e42f8d108 (diff) | |
download | llvm-1ba99eaf70951a4aa062688577047d8a23bfe54c.zip llvm-1ba99eaf70951a4aa062688577047d8a23bfe54c.tar.gz llvm-1ba99eaf70951a4aa062688577047d8a23bfe54c.tar.bz2 |
Revert "[DSE] Remove calls with known writes to dead memory"
This reverts commit a8a51fe55649f5e07f9f2973507dc20bc4e40765.
This breaks the strncpy-overflow.cpp test case.
Diffstat (limited to 'llvm/lib/Analysis/MemoryLocation.cpp')
-rw-r--r-- | llvm/lib/Analysis/MemoryLocation.cpp | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/llvm/lib/Analysis/MemoryLocation.cpp b/llvm/lib/Analysis/MemoryLocation.cpp index 6365828..c74b625 100644 --- a/llvm/lib/Analysis/MemoryLocation.cpp +++ b/llvm/lib/Analysis/MemoryLocation.cpp @@ -147,44 +147,7 @@ MemoryLocation::getForDest(const CallBase *CB, const TargetLibraryInfo &TLI) { } } - if (!CB->onlyAccessesArgMemory()) - return None; - - if (CB->hasOperandBundles()) - // TODO: remove implementation restriction - return None; - - Value *UsedV = nullptr; - Optional<unsigned> UsedIdx; - for (unsigned i = 0; i < CB->arg_size(); i++) { - if (!CB->getArgOperand(i)->getType()->isPointerTy()) - continue; - if (!CB->doesNotCapture(i)) - // capture would allow the address to be read back in an untracked manner - return None; - if (CB->onlyReadsMemory(i)) - continue; - if (!UsedV) { - // First potentially writing parameter - UsedV = CB->getArgOperand(i); - UsedIdx = i; - continue; - } - UsedIdx = None; - if (UsedV != CB->getArgOperand(i)) - // Can't describe writing to two distinct locations. - // TODO: This results in an inprecision when two values derived from the - // same object are passed as arguments to the same function. - return None; - } - if (!UsedV) - // We don't currently have a way to represent a "does not write" result - // and thus have to be conservative and return unknown. - return None; - - if (UsedIdx) - return getForArgument(CB, *UsedIdx, &TLI); - return MemoryLocation::getBeforeOrAfter(UsedV, CB->getAAMetadata()); + return None; } MemoryLocation MemoryLocation::getForArgument(const CallBase *Call, |