Args, Caller->getName(), Caller);
} else {
NC = new CallInst(Callee, Args, Caller->getName(), Caller);
+ if (cast<CallInst>(Caller)->isTailCall())
+ cast<CallInst>(NC)->setTailCall();
}
// Insert a cast of the return type as necessary...
// Create the call to Malloc...
CallInst *MCall = new CallInst(MallocFunc, MallocArgs, "", I);
+ MCall->setTailCall();
// Create a cast instruction to convert to the right type...
Value *MCast;
FreeArgs.push_back(Constant::getNullValue(FreeFTy->getParamType(i)));
// Insert a call to the free function...
- new CallInst(FreeFunc, FreeArgs, "", I);
+ (new CallInst(FreeFunc, FreeArgs, "", I))->setTailCall();
// Delete the old free instruction
I = --BBIL.erase(I);
Args[i] = ConstantExpr::getCast(cast<Constant>(Args[i]),
FT->getParamType(i));
- new CallInst(WriteFn, Args, "", IB);
+ (new CallInst(WriteFn, Args, "", IB))->setTailCall();
}
}
writeAbortMessage(UI);
// Insert a call to abort()
- new CallInst(AbortFn, std::vector<Value*>(), "", UI);
+ (new CallInst(AbortFn, std::vector<Value*>(), "", UI))->setTailCall();
// Insert a return instruction. This really should be a "barrier", as it
// is unreachable.
writeAbortMessage(RI);
// Insert a call to abort()
- new CallInst(AbortFn, std::vector<Value*>(), "", RI);
+ (new CallInst(AbortFn, std::vector<Value*>(), "", RI))->setTailCall();
}
return Changed;