[LLVMdev] cyclical use between caller and callee

charles quarra charllsnotieneningunputocorreo at gmail.com
Tue Mar 26 23:01:19 PDT 2013


Hi,

I have two functions in a module, X.foo, which is the callee, and
Y.foo2, which calls X.foo.

If i either try to run llvm::Function::eraseFromParent() on any one of
the functions, i'll
get this assertion error:

F is used in instruction:
  %"calling function" = call i32 @X.foo(i32 %read)
F is used in instruction:
  %"calling function" = call i32 @X.foo(i32 %read)
While deleting: i32 (i32)* %X.foo
Use still stuck around after Def is destroyed:  %"calling function" =
call i32 @X.foo(i32 %read)
mytests: Value.cpp:75: virtual llvm::Value::~Value(): Assertion
`use_empty() && "Uses remain when a value is destroyed!"' failed.

regardless of which one i call first.

What is the appropiate way to delete a function from an existing module?



More information about the llvm-dev mailing list