[llvm] 1a726cf - Take memset_inline into account in analyzeLoadFromClobberingMemInst

Guillaume Chatelet via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 02:50:29 PDT 2022


Author: Guillaume Chatelet
Date: 2022-10-26T09:50:13Z
New Revision: 1a726cfa83667585dd87a9955ed5e331cad45d18

URL: https://github.com/llvm/llvm-project/commit/1a726cfa83667585dd87a9955ed5e331cad45d18
DIFF: https://github.com/llvm/llvm-project/commit/1a726cfa83667585dd87a9955ed5e331cad45d18.diff

LOG: Take memset_inline into account in analyzeLoadFromClobberingMemInst

This appeared in https://reviews.llvm.org/D126903#3884061

Differential Revision: https://reviews.llvm.org/D136752

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/VNCoercion.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/VNCoercion.cpp b/llvm/lib/Transforms/Utils/VNCoercion.cpp
index 42be67f3cfc05..264da2187754a 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;
     }


        


More information about the llvm-commits mailing list