@@ -125,7 +125,7 @@ bool attributeKnownFunctions(llvm::Function &F) {
125125 if (F.getName () == " fprintf" ) {
126126 for (auto &arg : F.args ()) {
127127 if (arg.getType ()->isPointerTy ()) {
128- arg.addAttr (Attribute::NoCapture );
128+ addFunctionNoCapture (&F, arg.getArgNo () );
129129 changed = true ;
130130 }
131131 }
@@ -148,7 +148,7 @@ bool attributeKnownFunctions(llvm::Function &F) {
148148 for (auto &arg : F.args ()) {
149149 if (arg.getType ()->isPointerTy ()) {
150150 arg.addAttr (Attribute::ReadNone);
151- arg.addAttr (Attribute::NoCapture );
151+ addFunctionNoCapture (&F, arg.getArgNo () );
152152 }
153153 }
154154 }
@@ -168,7 +168,7 @@ bool attributeKnownFunctions(llvm::Function &F) {
168168 F.addFnAttr (Attribute::NoSync);
169169 for (int i = 0 ; i < 2 ; i++)
170170 if (F.getFunctionType ()->getParamType (i)->isPointerTy ()) {
171- F. addParamAttr (i, Attribute::NoCapture );
171+ addFunctionNoCapture (&F, i );
172172 F.addParamAttr (i, Attribute::WriteOnly);
173173 }
174174 }
@@ -192,7 +192,7 @@ bool attributeKnownFunctions(llvm::Function &F) {
192192 F.addFnAttr (Attribute::NoSync);
193193 F.addParamAttr (0 , Attribute::WriteOnly);
194194 if (F.getFunctionType ()->getParamType (2 )->isPointerTy ()) {
195- F. addParamAttr ( 2 , Attribute::NoCapture );
195+ addFunctionNoCapture (&F, 2 );
196196 F.addParamAttr (2 , Attribute::WriteOnly);
197197 }
198198 F.addParamAttr (6 , Attribute::WriteOnly);
@@ -211,7 +211,7 @@ bool attributeKnownFunctions(llvm::Function &F) {
211211 F.addFnAttr (Attribute::NoSync);
212212 F.addParamAttr (0 , Attribute::ReadOnly);
213213 if (F.getFunctionType ()->getParamType (2 )->isPointerTy ()) {
214- F. addParamAttr ( 2 , Attribute::NoCapture );
214+ addFunctionNoCapture (&F, 2 );
215215 F.addParamAttr (2 , Attribute::ReadOnly);
216216 }
217217 F.addParamAttr (6 , Attribute::WriteOnly);
@@ -231,12 +231,12 @@ bool attributeKnownFunctions(llvm::Function &F) {
231231 F.addFnAttr (Attribute::NoSync);
232232
233233 if (F.getFunctionType ()->getParamType (0 )->isPointerTy ()) {
234- F. addParamAttr ( 0 , Attribute::NoCapture );
234+ addFunctionNoCapture (&F, 0 );
235235 F.addParamAttr (0 , Attribute::ReadOnly);
236236 }
237237 if (F.getFunctionType ()->getParamType (1 )->isPointerTy ()) {
238238 F.addParamAttr (1 , Attribute::WriteOnly);
239- F. addParamAttr ( 1 , Attribute::NoCapture );
239+ addFunctionNoCapture (&F, 1 );
240240 }
241241 }
242242 if (F.getName () == " MPI_Wait" || F.getName () == " PMPI_Wait" ) {
@@ -246,9 +246,9 @@ bool attributeKnownFunctions(llvm::Function &F) {
246246 F.addFnAttr (Attribute::WillReturn);
247247 F.addFnAttr (Attribute::NoFree);
248248 F.addFnAttr (Attribute::NoSync);
249- F. addParamAttr ( 0 , Attribute::NoCapture );
249+ addFunctionNoCapture (&F, 0 );
250250 F.addParamAttr (1 , Attribute::WriteOnly);
251- F. addParamAttr ( 1 , Attribute::NoCapture );
251+ addFunctionNoCapture (&F, 1 );
252252 }
253253 if (F.getName () == " MPI_Waitall" || F.getName () == " PMPI_Waitall" ) {
254254 changed = true ;
@@ -257,9 +257,9 @@ bool attributeKnownFunctions(llvm::Function &F) {
257257 F.addFnAttr (Attribute::WillReturn);
258258 F.addFnAttr (Attribute::NoFree);
259259 F.addFnAttr (Attribute::NoSync);
260- F. addParamAttr ( 1 , Attribute::NoCapture );
260+ addFunctionNoCapture (&F, 1 );
261261 F.addParamAttr (2 , Attribute::WriteOnly);
262- F. addParamAttr ( 2 , Attribute::NoCapture );
262+ addFunctionNoCapture (&F, 2 );
263263 }
264264 // Map of MPI function name to the arg index of its type argument
265265 std::map<std::string, int > MPI_TYPE_ARGS = {
@@ -2347,7 +2347,7 @@ class EnzymeBase {
23472347 for (size_t i = 0 ; i < num_args; ++i) {
23482348 if (CI->getArgOperand (i)->getType ()->isPointerTy ()) {
23492349 CI->addParamAttr (i, Attribute::ReadNone);
2350- CI-> addParamAttr (i, Attribute::NoCapture );
2350+ addCallSiteNoCapture (CI, i );
23512351 }
23522352 }
23532353 }
@@ -2361,7 +2361,7 @@ class EnzymeBase {
23612361 for (size_t i = 0 ; i < num_args; ++i) {
23622362 if (CI->getArgOperand (i)->getType ()->isPointerTy ()) {
23632363 CI->addParamAttr (i, Attribute::ReadNone);
2364- CI-> addParamAttr (i, Attribute::NoCapture );
2364+ addCallSiteNoCapture (CI, i );
23652365 }
23662366 }
23672367 }
@@ -2375,7 +2375,7 @@ class EnzymeBase {
23752375 for (size_t i = 0 ; i < num_args; ++i) {
23762376 if (CI->getArgOperand (i)->getType ()->isPointerTy ()) {
23772377 CI->addParamAttr (i, Attribute::ReadNone);
2378- CI-> addParamAttr (i, Attribute::NoCapture );
2378+ addCallSiteNoCapture (CI, i );
23792379 }
23802380 }
23812381 }
@@ -2389,7 +2389,7 @@ class EnzymeBase {
23892389 for (size_t i = 0 ; i < num_args; ++i) {
23902390 if (CI->getArgOperand (i)->getType ()->isPointerTy ()) {
23912391 CI->addParamAttr (i, Attribute::ReadNone);
2392- CI-> addParamAttr (i, Attribute::NoCapture );
2392+ addCallSiteNoCapture (CI, i );
23932393 }
23942394 }
23952395 }
@@ -2439,9 +2439,9 @@ class EnzymeBase {
24392439 CI->addAttribute (AttributeList::FunctionIndex, Attribute::ReadOnly);
24402440#endif
24412441 CI->addParamAttr (1 , Attribute::ReadOnly);
2442- CI-> addParamAttr ( 1 , Attribute::NoCapture );
2442+ addCallSiteNoCapture (CI, 1 );
24432443 CI->addParamAttr (3 , Attribute::ReadOnly);
2444- CI-> addParamAttr ( 3 , Attribute::NoCapture );
2444+ addCallSiteNoCapture (CI, 3 );
24452445 }
24462446 if (Fn->getName () == " frexp" || Fn->getName () == " frexpf" ||
24472447 Fn->getName () == " frexpl" ) {
@@ -2502,7 +2502,7 @@ class EnzymeBase {
25022502 for (size_t i : {0 , 1 }) {
25032503 if (i < num_args &&
25042504 CI->getArgOperand (i)->getType ()->isPointerTy ()) {
2505- CI-> addParamAttr (i, Attribute::NoCapture );
2505+ addCallSiteNoCapture (CI, i );
25062506 }
25072507 }
25082508 }
@@ -2527,7 +2527,7 @@ class EnzymeBase {
25272527 for (size_t i : {0 , 2 }) {
25282528 if (i < num_args &&
25292529 CI->getArgOperand (i)->getType ()->isPointerTy ()) {
2530- CI-> addParamAttr (i, Attribute::NoCapture );
2530+ addCallSiteNoCapture (CI, i );
25312531 }
25322532 }
25332533 }
@@ -2553,7 +2553,7 @@ class EnzymeBase {
25532553 for (size_t i : {0 , 1 , 2 , 3 }) {
25542554 if (i < num_args &&
25552555 CI->getArgOperand (i)->getType ()->isPointerTy ()) {
2556- CI-> addParamAttr (i, Attribute::NoCapture );
2556+ addCallSiteNoCapture (CI, i );
25572557 }
25582558 }
25592559 }
@@ -2579,7 +2579,7 @@ class EnzymeBase {
25792579 for (size_t i : {0 }) {
25802580 if (i < num_args &&
25812581 CI->getArgOperand (i)->getType ()->isPointerTy ()) {
2582- CI-> addParamAttr (i, Attribute::NoCapture );
2582+ addCallSiteNoCapture (CI, i );
25832583 }
25842584 }
25852585 }
@@ -2601,7 +2601,7 @@ class EnzymeBase {
26012601 for (size_t i = 0 ; i < num_args; ++i) {
26022602 if (CI->getArgOperand (i)->getType ()->isPointerTy ()) {
26032603 CI->addParamAttr (i, Attribute::ReadOnly);
2604- CI-> addParamAttr (i, Attribute::NoCapture );
2604+ addCallSiteNoCapture (CI, i );
26052605 }
26062606 }
26072607 }
0 commit comments