diff options
author | Florian Hahn <flo@fhahn.com> | 2020-09-28 16:08:30 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2020-09-29 09:10:27 +0100 |
commit | 86a20d9e34f5a9989da72097f23f3b0a44157e73 (patch) | |
tree | cd6e240fbb1db01fdfbc54be2612548d61b447c7 /llvm/lib/Analysis/Loads.cpp | |
parent | 4c19b89b2587f321e1014a9855973c08a822b908 (diff) | |
download | llvm-86a20d9e34f5a9989da72097f23f3b0a44157e73.zip llvm-86a20d9e34f5a9989da72097f23f3b0a44157e73.tar.gz llvm-86a20d9e34f5a9989da72097f23f3b0a44157e73.tar.bz2 |
Recommit "[SCCP] Do not replace deref'able ptr with un-deref'able one."
This version includes an small fix allowing function pointers to be
unconditionally replaced for now.
This reverts commit 4c5e4aa89b11ec3253258b8df5125833773d1b1e.
Diffstat (limited to 'llvm/lib/Analysis/Loads.cpp')
-rw-r--r-- | llvm/lib/Analysis/Loads.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp index d63f6b9..5b9f466 100644 --- a/llvm/lib/Analysis/Loads.cpp +++ b/llvm/lib/Analysis/Loads.cpp @@ -510,6 +510,10 @@ bool llvm::canReplacePointersIfEqual(Value *A, Value *B, const DataLayout &DL, assert(Ty == B->getType() && Ty->isPointerTy() && "values must have matching pointer types"); + // Function pointers are not directly dereferenced using load/store + // instructions. Allow any replacements for now. + if (A->getType()->getPointerElementType()->isFunctionTy()) + return true; // NOTE: The checks in the function are incomplete and currently miss illegal // cases! The current implementation is a starting point and the // implementation should be made stricter over time. |