================
@@ -3283,10 +3285,15 @@ static bool isAllocSiteRemovable(Instruction *AI,
           case Intrinsic::memcpy:
           case Intrinsic::memset: {
             MemIntrinsic *MI = cast<MemIntrinsic>(II);
-            if (MI->isVolatile() || MI->getRawDest() != PI)
+            if (MI->isVolatile())
               return false;
+            // Note: this could also be ModRef, but we can still interpret 
that as just Mod in that case.
+            ModRefInfo NewAccess = MI->getRawDest() == PI ? ModRefInfo::Mod : 
ModRefInfo::Ref;
+            if ((Access & ~NewAccess) != ModRefInfo::NoModRef)
+              return false;
----------------
nikic wrote:

Rather than doing these individual checks, can we have a centralized check in 
the loop that does the early bailout for `Access == ModRef`?

https://github.com/llvm/llvm-project/pull/143958
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to