================ @@ -3339,16 +3340,23 @@ static bool isAllocSiteRemovable(Instruction *AI, if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) { switch (II->getIntrinsicID()) { default: - return false; + return std::nullopt; case Intrinsic::memmove: case Intrinsic::memcpy: case Intrinsic::memset: { MemIntrinsic *MI = cast<MemIntrinsic>(II); - if (MI->isVolatile() || MI->getRawDest() != PI) - return false; - [[fallthrough]]; + if (MI->isVolatile()) + return std::nullopt; + // 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 std::nullopt; + Access |= NewAccess; } + [[fallthrough]]; ---------------- nikic wrote:
Weird formatting. Can keep the fallthrough in the braces? 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