When one moves an instruction from one BasicBlock to another, the instruction continues to believe that its parent is the original BasicBlock. This is very undesirable. Is there a way to set the parent or a way to move the instruction such that the parent is updated correctly?
Currently, my way around this was to go into Instruction.h and make setParent() public. I hope there is a better way? -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Patrick Meredith Sent: Tuesday, May 31, 2005 8:17 AM To: 'LLVM Developers Mailing List' Subject: [LLVMdev] setting instruction parents When one moves an instruction from one BasicBlock to another, the instruction continues to believe that its parent is the original BasicBlock. This is very undesirable. Is there a way to set the parent or a way to move the instruction such that the parent is updated correctly? _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
On Tue, May 31, 2005 at 08:42:26AM -0500, Patrick Meredith wrote:> Currently, my way around this was to go into Instruction.h and make > setParent() public. I hope there is a better way?You shouldn't be modifying the API like this ...> When one moves an instruction from one BasicBlock to another, the > instruction continues to believe that its parent is the original > BasicBlock. This is very undesirable. Is there a way to set the > parent or a way to move the instruction such that the parent is > updated correctly?See LICM::hoist() in lib/Transforms/Scalar/LICM.cpp for an example. -- Misha Brukman :: http://misha.brukman.net :: http://llvm.cs.uiuc.edu