[LLVMdev] instruction sequence

Chris Lattner sabre at nondot.org
Fri Jun 30 23:51:23 PDT 2006


On Fri, 30 Jun 2006, Jerry Hom wrote:
>   IP = new LoadInst(GVstderr, "loadstderr", IP);
>   IPstderr = IP;

This creates a load, inserting it before "IP".  It then sets IP to the 
load.

>   std::vector<Value*> args;
>   args.push_back(IPstderr);
>   args.push_back(gep);
>
>   IP = new CallInst(F, args, "", IP);

This creates a call, inserting it before IP (the load), which is the 
problem.  If you don't modify IP when you insert the load, it should work.

-Chris

> ****************************************
>
> However, I'm getting the following error message:
>
> ----------------------------------------
> Instruction does not dominate all uses!
>        %loadstderr = load %struct._IO_FILE** %stderr           ; <%struct._IO_FILE*> [#uses=1]
>        call int (%struct._IO_FILE*, sbyte*, ...)* %fprintf( %struct._IO_FILE* %loadstderr, sbyte* getelementptr ([6 x sbyte]* %0, uint 0, uint 0) )           ; <int>:0 [#uses=0]
> Broken module found, compilation aborted!
> ----------------------------------------
>
> Can someone tell me what I'm doing wrong?  Thanks.
>
>

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list