summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2022-10-26 09:34:34 +0000
committerTobias Hieta <tobias@hieta.se>2022-10-28 09:37:34 +0200
commit9d46557baa84ab4342707c119cf9c77c9148230e (patch)
treebd114eedb2a9bd391c41a2c7fb0319ba3b5373ed
parentdd711a9391226189476f23f793fb98e244d52a4b (diff)
downloadllvm-9d46557baa84ab4342707c119cf9c77c9148230e.tar.gz
Take memset_inline into account in analyzeLoadFromClobberingMemInst
This appeared in https://reviews.llvm.org/D126903#3884061 Differential Revision: https://reviews.llvm.org/D136752 (cherry picked from commit 1a726cfa83667585dd87a9955ed5e331cad45d18)
-rw-r--r--llvm/lib/Transforms/Utils/VNCoercion.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/VNCoercion.cpp b/llvm/lib/Transforms/Utils/VNCoercion.cpp
index 42be67f3cfc0..264da2187754 100644
--- a/llvm/lib/Transforms/Utils/VNCoercion.cpp
+++ b/llvm/lib/Transforms/Utils/VNCoercion.cpp
@@ -356,9 +356,9 @@ int analyzeLoadFromClobberingMemInst(Type *LoadTy, Value *LoadPtr,
// If this is memset, we just need to see if the offset is valid in the size
// of the memset..
- if (MI->getIntrinsicID() == Intrinsic::memset) {
+ if (const auto *memset_inst = dyn_cast<MemSetInst>(MI)) {
if (DL.isNonIntegralPointerType(LoadTy->getScalarType())) {
- auto *CI = dyn_cast<ConstantInt>(cast<MemSetInst>(MI)->getValue());
+ auto *CI = dyn_cast<ConstantInt>(memset_inst->getValue());
if (!CI || !CI->isZero())
return -1;
}