Abhinash Jain
2013-Oct-21 11:07 UTC
[LLVMdev] How to fix the operand references of cloned instruction
I have cloned an instruction from one basic block to another newly created block in newly created function. And since am cloning an instruction the operands of that instruction still points to the instructions of old block. Due to which am getting an error as "Instruction does not dominate all uses!". example:- original function and block:- %a = alloca i32, align 4 %x = alloca i32, align 4 %y = alloca i32, align 4 %35 = load i32* %x, align 4 %36 = load i32* %y, align 4 %37 = load i32* %a, align 4 %mul17 = mul nsw i32 %35, %36 %add18 = add nsw i32 %mul17, %37 When cloned in a newly created basic block of newly created funtion :- %0 = alloca i32, align 4 %1 = load i32* %a, align 4 %2 = alloca i32, align 4 %3 = load i32* %y, align 4 %4 = alloca i32, align 4 %5 = load i32* %x, align 4 %6 = mul nsw i32 %35, %36 %7 = add nsw i32 %mul17, %37 Now as we can see that operands of cloned instruction are still pointing to old block. How can I resolve this reference to make it point to new block only? I did see RemapInstruction and ValueMap, but being new to llvm I could not able to make proper use of it. So it would be great if you could help me implementing this. Thnx -- View this message in context: http://llvm.1065342.n5.nabble.com/How-to-fix-the-operand-references-of-cloned-instruction-tp62275.html Sent from the LLVM - Dev mailing list archive at Nabble.com.