1: %mul2 = fmul float %1, %1
2: %mul3 = fmul float %mul2, %1
3: %mul4 = fmul float %mul3, %1
4: %mul5 = fmul float %mul4, %1
5: %mul6 = fmul float %mul5, %1
6: %mul7 = fmul float %mul6, %1
7: store float %mul5, float* %x, align 4, !tbaa !0
I want to set the next node of %mul5 to %mul7. getNextNode() function gives the next node as %mul6(which I want to delete). Is there any function to do this?
getNextNode() is an internal implementation details of stuff deep inside LLVM API. You should never use it. Use the standard LLVM API to manipulate the list of instructions: iterators and IRBuilder. See http://llvm.org/docs/ProgrammersManual.html#simplechanges and http://llvm.org/doxygen/classllvm_1_1IRBuilder.html for more information.
Also, before deleting %mul6 you have to replace all uses of it.