File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,7 @@ class Enzyme : public ModulePass {
147
147
bool AtomicAdd = Arch == Triple::nvptx || Arch == Triple::nvptx64 ||
148
148
Arch == Triple::amdgcn;
149
149
150
+ std::map<int , Type*> byVal;
150
151
for (unsigned i = 1 ; i < CI->getNumArgOperands (); ++i) {
151
152
Value *res = CI->getArgOperand (i);
152
153
@@ -357,7 +358,9 @@ class Enzyme : public ModulePass {
357
358
}
358
359
res = Builder.CreateBitCast (res, PTy);
359
360
}
360
-
361
+ if (CI->isByValArgument (i)) {
362
+ byVal[args.size ()] = CI->getParamByValType (i);
363
+ }
361
364
args.push_back (res);
362
365
if (ty == DIFFE_TYPE::DUP_ARG || ty == DIFFE_TYPE::DUP_NONEED) {
363
366
++i;
@@ -476,6 +479,9 @@ class Enzyme : public ModulePass {
476
479
CallInst *diffret = cast<CallInst>(Builder.CreateCall (newFunc, args));
477
480
diffret->setCallingConv (CI->getCallingConv ());
478
481
diffret->setDebugLoc (CI->getDebugLoc ());
482
+ for (auto pair : byVal) {
483
+ diffret->addParamAttr (pair.first , Attribute::getWithByValType (diffret->getContext (), pair.second ));
484
+ }
479
485
480
486
if (!diffret->getType ()->isEmptyTy () && !diffret->getType ()->isVoidTy ()) {
481
487
unsigned idxs[] = {0 };
You can’t perform that action at this time.
0 commit comments