[llvm-dev] Moving instructions from source Basic Block to dest Basic Block
Jajoo, Malhar via llvm-dev
llvm-dev at lists.llvm.org
Fri May 26 05:39:16 PDT 2017
Hi,
I have been trying to move some instructions between basic blocks ,
After looking at the API , I found llvm::Instruction::clone() but there
is no result value for this.
For example-
source Basic block :
continuation: ; preds = %else, %then
%iftmp = phi i32 [ 5, %then ], [ 9, %else ]
store i32 %iftmp, i32* %datasize
; 3 instructions below being copied
store i8000000 0, i8000000* %res
%res4 = load i8000000, i8000000* %res
ret i8000000 %res4
After copying the 3 instructions above to destination basic block.
destination basic block :
else: ; preds = %entry
store i8000000 0, i8000000* %res
%1---->issue = load i8000000, i8000000* %res
ret i8000000 %res4 -----> issue , need to get result of instruction above.
br label %continuation
I had tried using a simple Instruction::insert() earlier but ran
into an assertion error complaining that the Function contained duplicated instruction.
My Question : How to copy an instruction ( along with it's name , or the LHS of the instruction )
Is it possible to do name the LHS of the instruction using clone() ?
Thanks,
Malhar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170526/408ec6e5/attachment-0001.html>
More information about the llvm-dev
mailing list