On Thursday 02 August 2007 18:15, Chandler Carruth wrote: > .../include/llvm/Instructions.h: In member function 'void > llvm::CallInst::init(llvm::Value*, InputIterator, InputIterator, const > std::string&, std::random_access_iterator_tag) [with InputIterator = > llvm::Use*]': > .../include/llvm/Instructions.h:788: instantiated from > 'llvm::CallInst::CallInst(llvm::Value*, InputIterator, InputIterator, > const std::string&, llvm::Instruction*) [with InputIterator = llvm::Use*]' > .../lib/VMCore/AutoUpgrade.cpp:144: instantiated from here > .../include/llvm/Instructions.h:766: error: no matching function for > call to 'llvm::CallInst::init(llvm::Value*&, llvm::Use*, ptrdiff_t&)' > .../include/llvm/Instructions.h:750: note: candidates are: void > llvm::CallInst::init(llvm::Value*, llvm::Value* const*, unsigned int) > ....
You're trying to construct with pointers to Use, which are not compatible with this interface as explained here: > > namespace { > > @@ -197,8 +198,18 @@ > > CI->setOperand(0, GCRead); > > } else { > > // Create a whole new call to replace the old one. > > - CallInst *NC = new CallInst(GCRead, CI->getOperand(1), > > - CI->getOperand(2), > > + > > + // It sure would be nice to pass op_begin()+1, > > + // op_begin()+2 but it runs into trouble with > > + // CallInst::init's &*ierator, which requires a > > + // conversion from Use* to Value*. The conversion > > + // from Use to Value * is not useful because the > > + // memory for Value * won't be contiguous. > > + SmallVector<Value *, 2> Args; > > + Args.push_back(CI->getOperand(1)); > > + Args.push_back(CI->getOperand(2)); > > + CallInst *NC = new CallInst(GCRead, Args.begin(), > > + Args.end(), > > CI->getName(), CI); You simply cannot construct with Use*. As far as I know, you could not do so before either because the CallInst(...,Value *, NumArgs,...) constructor assumed a contiguous array of Value * which Use * most definitely does not provide. -Dave _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits