[LLVMdev] CloneFunctionInto() Error
Rasha Omar
rasha.sala7 at gmail.com
Wed May 29 01:14:50 PDT 2013
Dear All,
I need your help urgently
I have to copy the CFG of each function using CloneFunction or
CloneFunctionInto.
After I made the copy function. Print the basic blocks then get this error :
While deleting: i32 %
Use still stuck around after Def is destroyed: %mul2_ = mul nsw i32 %6, 3
Use still stuck around after Def is destroyed: store i32 3, i32* %x_,
align 4
opt: Value.cpp:75: virtual llvm::Value::~Value(): Assertion `use_empty() &&
"Uses remain when a value is destroyed!"' failed.
0 opt 0x0000000000fc7fe2
1 opt 0x0000000000fc8473
2 libpthread.so.0 0x00007f0396f43cb0
3 libc.so.6 0x00007f0396195425 gsignal + 53
4 libc.so.6 0x00007f0396198b8b abort + 379
5 libc.so.6 0x00007f039618e0ee
6 libc.so.6 0x00007f039618e192
7 opt 0x0000000000f7cd7d
8 opt 0x0000000000ee3c52
9 opt 0x0000000000f5bddf
llvm::LLVMContextImpl::~LLVMContextImpl() + 1999
10 opt 0x0000000000f5ad1c
11 opt 0x0000000000fb9d69 llvm::llvm_shutdown() + 41
12 opt 0x00000000005285b3 main + 7251
13 libc.so.6 0x00007f039618076d __libc_start_main + 237
14 opt 0x0000000000521f91
Stack dump:
0. Program arguments: opt -load ../../../Release+Asserts/lib/Blocks.so
-blocks
Aborted (core dumped)
***The code is
> std::vector<Type*> ArgTypes;
> ValueToValueMapTy VMap;
>FunctionType *FTy =
FunctionType::get(F.getFunctionType()->getReturnType(),
ArgTypes, F.getFunctionType()->isVarArg());
>Function *NewF = Function::Create(FTy, F.getLinkage(), F.getName());
> SmallVector<ReturnInst*, 8> Returns;
>CloneFunctionInto(NewF, (Function*) &F, VMap, false, Returns, "_", 0, 0);
Thanks in advance
--
*Rasha Salah Omar
Msc Student at E-JUST
Demonestrator at Faculty of Computers and Informatics
Benha University
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130529/eb457e30/attachment.html>
More information about the llvm-dev
mailing list