[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 6 10:57:42 PST 2025
================
@@ -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);
----------------
goldsteinn wrote:
Don't need to set changed?
https://github.com/llvm/llvm-project/pull/125880
More information about the cfe-commits
mailing list