# HG changeset patch # User Shinji KONO # Date 1591416935 -32400 # Node ID b1364f705114a0010bd7b1f8636227aa9437e681 # Parent 390e42bfd95abe31e7826d0771650cefc09c73e6 relax tail call error on goto from normal function. args.c worked. diff -r 390e42bfd95a -r b1364f705114 llvm/include/llvm/IR/Instructions.h --- a/llvm/include/llvm/IR/Instructions.h Sat Jun 06 00:15:13 2020 +0900 +++ b/llvm/include/llvm/IR/Instructions.h Sat Jun 06 13:15:35 2020 +0900 @@ -1366,6 +1366,7 @@ /// hold the calling convention of the call. /// class CallInst : public CallBase { + int count; CallInst(const CallInst &CI); /// Construct a CallInst given a range of arguments. diff -r 390e42bfd95a -r b1364f705114 llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Sat Jun 06 00:15:13 2020 +0900 +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Sat Jun 06 13:15:35 2020 +0900 @@ -7163,8 +7163,11 @@ #ifndef noCbC // if code segment's tail call flag was changed false , we report it on error. if (RetTy->is__CodeTy() && !isTailCall ) { - LLVMContext &Ctx = *DAG.getContext(); - Ctx.emitError(&CB, "tail call failed on __code"); + if (CB.getCaller()->getReturnType()->is__CodeTy()) { + // LLVMContext &Ctx = *DAG.getContext(); + //- Ctx.emitError(&CB, "tail call failed on __code"); + errs() << "tail call failed on __code " + CB.getCaller()->getName() ; + } } #endif std::pair Result = lowerInvokable(CLI, EHPadBB); @@ -10633,3 +10636,13 @@ setValue(&I, DAG.getNode(ISD::MERGE_VALUES, getCurSDLoc(), DAG.getVTList(ValueVTs), Values)); } + +void printInsts(Instruction* inst) { // useless on const Instruction* inst + BasicBlock::iterator it(inst); + ++it; // After this line, it refers to the instruction after *inst + if (it != inst->getParent()->end()) errs() << *it << "\n"; +} + +void printInst(Instruction it) { + errs() << it << "\n"; +} diff -r 390e42bfd95a -r b1364f705114 llvm/lib/IR/Instructions.cpp --- a/llvm/lib/IR/Instructions.cpp Sat Jun 06 00:15:13 2020 +0900 +++ b/llvm/lib/IR/Instructions.cpp Sat Jun 06 13:15:35 2020 +0900 @@ -423,8 +423,11 @@ // CallInst Implementation //===----------------------------------------------------------------------===// +static int call_count = 0; + void CallInst::init(FunctionType *FTy, Value *Func, ArrayRef Args, ArrayRef Bundles, const Twine &NameStr) { + this->count = call_count++; this->FTy = FTy; assert(getNumOperands() == Args.size() + CountBundleInputs(Bundles) + 1 && "NumOperands not set up?"); @@ -451,6 +454,7 @@ } void CallInst::init(FunctionType *FTy, Value *Func, const Twine &NameStr) { + this->count = call_count++; this->FTy = FTy; assert(getNumOperands() == 1 && "NumOperands not set up?"); setCalledOperand(Func);