[LLVMdev] code-altering Passes for llc

Artjom Kochtchi artjom.kochtchi at googlemail.com
Sat Aug 15 15:58:43 PDT 2009


I tried to insert a new MachineBasicBlock at the beginning of functions, but
when I do that like

  MachineBasicBlock *entry = MF.begin();
  const BasicBlock *block = entry->getBasicBlock();

  MachineBasicBlock *newMBB = MF.CreateMachineBasicBlock(block);			
  MachineInstrBuilder instr = BuildMI(labelBlock, TII->get(X86::NOOP));
  newMBB->addSuccessor(entry);
  MF.push_front(newMBB);




llc fails with the following error message. Can someone tell me what I am
doing wrong?

  llc: MachineRegisterInfo.cpp:33:
llvm::MachineRegisterInfo::~MachineRegisterInfo():
  Assertion `!PhysRegUseDefLists[i] && "PhysRegUseDefLists has entries after
all instructions are deleted"' failed.




Apart from that llc fails when I run my modified version on larger test
programs. The error message displayed is:

  lc: MachineBasicBlock.cpp:361:
  bool
llvm::MachineBasicBlock::CorrectExtraCFGEdges(llvm::MachineBasicBlock*,
llvm::MachineBasicBlock*, bool):
  Assertion `DestA == 0 && "MachineCFG is missing edges!"' failed.


I did not overwrite getAnalysisUsage, therefore not guaranteeing to preserve
anything. Clearly, the runtime check adds edges to the CFG. What may be the
cause of this error and how can I fix it?

-Artjom
-- 
View this message in context: http://www.nabble.com/code-altering-Passes-for-llc-tp24778261p24988862.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090815/55df5843/attachment.html>


More information about the llvm-dev mailing list