[llvm-branch-commits] [llvm] 9d46557 - Take memset_inline into account in analyzeLoadFromClobberingMemInst

Tobias Hieta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Oct 28 00:37:54 PDT 2022


Author: Guillaume Chatelet
Date: 2022-10-28T09:37:34+02:00
New Revision: 9d46557baa84ab4342707c119cf9c77c9148230e

URL: https://github.com/llvm/llvm-project/commit/9d46557baa84ab4342707c119cf9c77c9148230e
DIFF: https://github.com/llvm/llvm-project/commit/9d46557baa84ab4342707c119cf9c77c9148230e.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

(cherry picked from commit 1a726cfa83667585dd87a9955ed5e331cad45d18)

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-branch-commits mailing list