Skip to content
Snippets Groups Projects
Commit fc5f0cf5 authored by Prakalp Srivastava's avatar Prakalp Srivastava
Browse files

Fixed bug in VISCUtils. When changing in graph, we should also check __visc__launch call

parent df543d00
No related branches found
No related tags found
No related merge requests found
......@@ -46,6 +46,12 @@ static bool isViscCreateNodeCall(Instruction* I) {
return (CI->getCalledValue()->stripPointerCasts()->getName()).startswith("__visc__createNode");
}
static bool isViscLaunchCall(Instruction* I) {
if(!isa<CallInst>(I))
return false;
CallInst* CI = cast<CallInst>(I);
return (CI->getCalledValue()->stripPointerCasts()->getName()).startswith("__visc__launch");
}
// Creates a new createNode intrinsic, similar to II but with different
// associated function F instead
IntrinsicInst* createIdenticalCreateNodeIntrinsicWithDifferentFunction(Function* F,
......@@ -207,6 +213,16 @@ void replaceNodeFunctionInIR(Module &M, Function* F, Function* G) {
// Replace use of F with use of G
CI->setArgOperand(0, G);
DEBUG(errs() << "Fixed use: " << *CI << "\n");
} else if(isViscLaunchCall(I)) {
CallInst* CI = cast<CallInst>(I);
// The found launch call is not associated with the changed function
if (CI->getArgOperand(1)->stripPointerCasts() != F)
continue;
// Otherwise, replace F with G
errs() << *G->getType() << "\n";
errs() << *CI->getArgOperand(1)->getType() << "\n";
CI->setArgOperand(1, G);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment