[LLVMdev] ConstantPoolValue lifecycle question

Cameron Zwarich zwarich at apple.com
Sun Feb 20 13:49:34 PST 2011


I am investigating the leak in MC/ARM/elf-reloc-01.ll on the valgrind bot. It seems to be leaking two MachineConstantPoolValues. When a ConstantPoolSDNode is created with a ConstantPoolValue, it owns that ConstantPoolValue. In InstrEmitter::AddOperand(), the index of the CPV is taken from a MachineConstantPool, which has two cases:

1) This is a new constant, so a new entry is created. The MachineConstantPoolValue is freed in MachineConstantPool's destructor when it iterates over all of the entries in its table.

2) This constant can share an existing entry. The MachineConstantPoolValue is not added to the MachineConstantPool's table and is not freed by MachineConstantPool's destructor.

Who owns the ConstantPoolValue in the second case and is responsible for freeing it?

Thanks,
Cameron



More information about the llvm-dev mailing list