[LLVMdev] assertion in LeakDetector

Manjunath Kudlur keveman at gmail.com
Wed Jun 3 17:48:20 PDT 2009


Hi Bill,

I am using the following version of BuildMI :

MachineInstrBuilder  BuildMI(MachineFunction &MF,
                                    const TargetInstrDesc &TID,
                                    unsigned DestReg)

I do the following :

void createInstrs(std::vector<MachineInstr *>& ilist)
{
  Machine Instr *mi;

  mi = BuildMI(MF, someTID, somereg);
  ilist.push_back(mi);
  mi = BuildMI(MF, someotherTID, someotherreg);
  ilist.push_back(mi);
}

viud insertInto(MachineBasicBlock *BB, MachineBasicBlock::iterator II)
{
   std::vector<MachineInstr *> temp;
   createInstrs(temp);

   for(unsigned i=0, e=temp.size(); i!=e; ++i)
     BB->insert(II, temp[i]);
}

I am getting the assertion during BB->insert()

Manjunath
On Wed, Jun 3, 2009 at 5:26 PM, Bill Wendling <isanbard at gmail.com> wrote:
> On Wed, Jun 3, 2009 at 5:10 PM, Manjunath Kudlur <keveman at gmail.com> wrote:
>> I am seeing the following assertion in leak detector.
>>
>> /llvm/lib/VMCore/LeakDetector.cpp:43:
>> void<unnamed>::LeakDetectorImpl<T>::addGarbage(const T*) [with T =
>> void]: Assertion `Ts.count(Cache) == 0 && "Object already in set!"'
>> failed.
>>
>> I am creating a list of instructions using BuildMI() and adding them
>> to a basic block using BB->insert(). I am seeing this assertion after
>> some number of insertions. Am I doing something wrong?
>>
> Hi Manjunath,
>
> If you are using BuildMI(), you shouldn't have to re-insert the
> instruction into the machine basic block.
>
> -bw
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list