================ @@ -1281,17 +1321,15 @@ static void addArgumentAttrs(const SCCNodeSet &SCCNodes, if (ArgumentSCC[0]->Uses.size() == 1 && ArgumentSCC[0]->Uses[0] == ArgumentSCC[0]) { Argument *A = ArgumentSCC[0]->Definition; - A->addAttr(Attribute::getWithCaptureInfo(A->getContext(), - CaptureInfo::none())); - ++NumNoCapture; - Changed.insert(A->getParent()); + CaptureInfo NewCI = ArgumentSCC[0]->CC; + if (NewCI != A->getAttributes().getCaptureInfo()) { + A->addAttr(Attribute::getWithCaptureInfo(A->getContext(), NewCI)); + addCapturesStat(NewCI); + Changed.insert(A->getParent()); + } - // Infer the access attributes given the new nocapture one - SmallPtrSet<Argument *, 8> Self; - Self.insert(&*A); - Attribute::AttrKind R = determinePointerAccessAttrs(&*A, Self); - if (R != Attribute::None) - addAccessAttr(A, R); + // Infer the access attributes given the new captures one + DetermineAccessAttrsForSingleton(A); ---------------- nikic wrote:
Done. It was not necessary previously because we always added nocapture. But now that it's conditional we should handle Changed separately for the access attrs. https://github.com/llvm/llvm-project/pull/125880 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits