[LLVMdev] Instruction does not dominate all uses! <badref> ??

Duncan Sands baldrick at free.fr
Fri Nov 2 03:55:03 PDT 2012


Hi edA-qa mort-ora-y,

On 02/11/12 10:20, edA-qa mort-ora-y wrote:
> I'm having trouble figuring out what the error "Instruction does not
> dominate all uses!" means. I'm trying to construct a call to a function
> with two parameters. The printed IR, with error, looks like this:
>
> define i32 @add(i32, i32) {
> EntryBlock:
>    %2 = add i32 %0, %1
>    ret i32 %2
> }
>
> define i32 @eval_expr() {
> EntryBlock:
>    ret i32 <badref>
> }
>
> Instruction does not dominate all uses!
>    <badref> = call i32 @add(i32 2, i32 3)
>    ret i32 <badref>

Looks like you forgot to add the call instruction to EntryBlock.

>
>
> And the approximate/simplified code I'm using to generate the call,
> which would appear at <badref> is:
>
> 	llvm::Value * func = module->getFunction( "add" );
> 	
> 	std::vector<llvm::Value*> args;
> 	args.push_back( llvm::ConstantInt::get( llvm::Type::getInt32Ty(
> *context ), 2 ) );
> 	args.push_back( llvm::ConstantInt::get( llvm::Type::getInt32Ty(
> *context ), 3 ) );
> 	
> 	llvm::ArrayRef<llvm::Value*> ar_args( args );
> 	return llvm::CallInst::Create( func, ar_args );

^ Didn't add it to a basic block.

Ciao, Duncan.

>
>
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list