[LLVMdev] Instruction does not dominate all uses?

Alec Benzer alecbenzer at gmail.com
Thu Aug 12 14:47:03 PDT 2010


Ah, ok, so the call to builder.CreateCall needs to come
after builder.SetInsertPoint for the wrapping function to work properly? I
think I get it now.

On Thu, Aug 12, 2010 at 4:26 PM, Reid Kleckner <reid.kleckner at gmail.com>wrote:

> You need to insert v into the basic block before the return.  Note
> that %calltmp is absent from the dump of the function.  The verifier
> is complaining because it found this pointer to %calltmp, but it
> didn't find the definition anywhere above its use.
>
> Reid
>
> On Thu, Aug 12, 2010 at 1:04 PM, alecbenzer <alecbenzer at gmail.com> wrote:
> >
> > This has been driving me crazy. In order to JIT stuff in a simple REPL
> I'm
> > trying to wrap them in anonymous functions and then evaluate them (as per
> > recommendation of the Kaleidoscope guide).
> >
> > With simple expressions it works fine. Like if I try and add 4 and 5, I
> get
> > this from the bare llvm::Value dump:
> >
> > double 9.000000e+00
> >
> > and this after it's wrapped in a function:
> >
> > define double @0() {
> > entry:
> >  ret double 9.000000e+00
> > }
> >
> >
> > Then I define a function (ignores its one parameter and returns 4):
> >
> > define double @test(double %x) {
> > entry:
> >  ret double 4.000000e+00
> > }
> >
> > And get the dump from the llvm::Value call to it (passing 10 as the arg)
> >
> > %calltmp = call double @test(double 1.000000e+01) ; <double> [#uses=1]
> >
> > the dump from the call wrapped in a function:
> >
> > define double @1() {
> > entry:
> >  ret double %calltmp
> > }
> >
> > but when I try to verify the wrapping function, I get:
> >
> > Instruction does not dominate all uses!
> >  %calltmp = call double @test(double 1.000000e+01) ; <double> [#uses=1]
> >  ret double %calltmp
> >
> > The code that I'm using to create the wrapping functions:
> > http://pastebin.com/1Jzm8LgP
> >
> > What's going on here? From what I understand , "Instruction does not
> > dominate all uses!" has to do with using a variable before its
> definition? I
> > don't see where/how that's happening here.
> >
> > --
> > View this message in context:
> http://old.nabble.com/Instruction-does-not-dominate-all-uses--tp29422733p29422733.html
> > Sent from the LLVM - Dev mailing list archive at Nabble.com.
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100812/b7cc44fb/attachment.html>


More information about the llvm-dev mailing list