[LLVMdev] Folding instructions on X86

Chris Lattner sabre at nondot.org
Sun Sep 24 23:41:25 PDT 2006

On Sun, 24 Sep 2006, Fernando Magno Quintao Pereira wrote:
>      I need help with one error in my register allocator. I am getting
> errors when folding instructions for the x86 (it does not happen when
> I use the PowerPC as target). The problem is that, when I execute
> something like: mi = mbb->insert(mbb->erase(mi), fmi), where mbb is a
> MachineBasicBlock, valgrind gives this error message:
> Address 0x42C62B0 is 24 bytes inside a block of size 28 free'd
>     at 0x401C35D: operator delete(void*)(vg_replace_malloc.c:244)
>     by 0x83E4A7B: llvm::iplist<llvm::MachineInstr,
> llvm::ilist_traits<llvm::MachineInstr>
>> ::erase(llvm::ilist_iterator<llvm::MachineInstr>) (ilist:323)
>     by 0x83E464D:
> llvm::MachineBasicBlock::erase(llvm::ilist_iterator<llvm::MachineInstr>)
> (MachineBasicBlock.h:168)

It's hard to say, but it seems that the pointer to erase is most likely 

> Do you guys know any possible reason of why this would happen when
> producing code for the X86, but not for the PowerPC?

X86 has many more instructions that can be folded than powerpc does. 
You're probably just happening to get unlucky on x86.



More information about the llvm-dev mailing list