From 9d46557baa84ab4342707c119cf9c77c9148230e Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Wed, 26 Oct 2022 09:34:34 +0000 Subject: 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) --- llvm/lib/Transforms/Utils/VNCoercion.cpp | 4 ++-- 1 file 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(MI)) { if (DL.isNonIntegralPointerType(LoadTy->getScalarType())) { - auto *CI = dyn_cast(cast(MI)->getValue()); + auto *CI = dyn_cast(memset_inst->getValue()); if (!CI || !CI->isZero()) return -1; } -- cgit v1.2.1