[LLVMdev] Playing with lli-Interpreter

César divcesar at gmail.com
Mon Jun 18 10:15:31 PDT 2012


I'm doing some experiments with the lli Interpreter and found that if
I clone the about to execute instruction inside the Interpreter::run()
method it causes this exception be thrown " llvm::Value::~Value():
Assertion `use_empty() && "Uses remain when a value is destroyed!"' ".

I'm stuck with this for several days, can someone explain a bit why
this is happening? To see the "problem" you can just try changing
Interpreter::run() to :

    Instruction *I2 = I->clone();
    visit(*I);   // Dispatch to one of the visit* methods...

and running lli with this bitcode file for example:

; ModuleID = 'test.bc'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"
target triple = "i386-pc-linux-gnu"

define i32 @main() nounwind {
entry:
  %retval = alloca i32, align 4
  store i32 0, i32* %retval
  ret i32 0
}

Note that the ->clone() doesn't change the use list of I neither I2.

many thanks.
César.




More information about the llvm-dev mailing list