[LLVMdev] Instruction does not dominate all uses! <badref> ??
edA-qa mort-ora-y
eda-qa at disemia.com
Fri Nov 2 04:51:41 PDT 2012
Okay, I've think I understand now. By using a "Value" object (like a
function call) in another instruction does nothing more than use a
reference to that value. It is still my responsibility to ensure that
value/reference is actually created prior to its use in the block.
On 02/11/12 12:16, Nick Lewycky wrote:
> 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>
>
> It's correct but not entirely helpful. You've got an instruction in
> function @eval_expr whose operand is an instruction in an entirely
> different function (or in no function at all).
>
>> 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 );
>
> This creates a CallInst but doesn't insert it into any basic block.
>
> Nick
>
>
--
edA-qa mort-ora-y
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121102/cfd0bd21/attachment.sig>
More information about the llvm-dev
mailing list