[LLVMdev] Instruction does not dominate all uses?

alecbenzer alecbenzer at gmail.com
Thu Aug 12 13:04:44 PDT 2010


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.




More information about the llvm-dev mailing list