================ @@ -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; ---------------- vtjnash wrote:
I originally was going to have it use AA to compute ModRef at the top, but that seemed potentially slower (since we already know PI aliases). I wasn't sure how else to centralize the test and also preserve exit early unless I just duplicate it at the top and after the loop (`if (Access == ModRefInfo::ModRef) return false`)? 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