girish gulawani
2012-Jan-24 16:57 UTC
[LLVMdev] Resolving branch instr with label "$BB0_-1"
Hello Anton. Thanks for the comment.> Precisely this is the situation! There're two consecutive branches (br1cond >> and br2uncond). Inside of AnalyzeBranch, there's an opcode swap of br2uncond >> (ex. j_foward to j_backward). There I do BuildMI (newOpcode) and followed by >> br2uncond->eraseFromParent(). This results in br1cond loosing it's >> label/offset. How could I resolve this? >Your code is broken. AnalyzeBranch should not modify anything. > > > >I was taking a clue from Mips/MipsInstrInfo.cpp: AnalyzeBranch :( >Could you please suggest appropriate alternative place for such a modification? >Best regards, > >Girish.-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120124/0e1db35d/attachment.html>
Anton Korobeynikov
2012-Jan-24 17:06 UTC
[LLVMdev] Resolving branch instr with label "$BB0_-1"
>> br2uncond->eraseFromParent(). This results in br1cond loosing it's >> label/offset. How could I resolve this? > Your code is broken. AnalyzeBranch should not modify anything. > > I was taking a clue from Mips/MipsInstrInfo.cpp: AnalyzeBranch :( > Could you please suggest appropriate alternative place for such a > modification?Ah sorry, my memory served me wrong. You can modify the stuff there, but very careful :) It's hard to tell w/o seeing the actual code. But I don't see how inserting new instruction inside MBB might invalidate the BB destinations of other stuff. If you're doing more complex stuff (e.g. insert / remove BBs), then you should carefully update all possible references. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
Hi girish, You can reference scalar transformation code under lib/Transforms/Scalar for some hints, such as LoopDeletion.cpp. As your transformation may cause CFG be changed, you should make sure you are not "AU.setPreservesCFG()". On 25 January 2012 01:06, Anton Korobeynikov <anton at korobeynikov.info>wrote:> >> br2uncond->eraseFromParent(). This results in br1cond loosing it's > >> label/offset. How could I resolve this? > > Your code is broken. AnalyzeBranch should not modify anything. > > > > I was taking a clue from Mips/MipsInstrInfo.cpp: AnalyzeBranch :( > > Could you please suggest appropriate alternative place for such a > > modification? > Ah sorry, my memory served me wrong. You can modify the stuff there, > but very careful :) > It's hard to tell w/o seeing the actual code. But I don't see how > inserting new instruction inside MBB might invalidate the BB > destinations of other stuff. > > If you're doing more complex stuff (e.g. insert / remove BBs), then > you should carefully update all possible references. > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University >-- Sincerely, Aries Wu -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120125/bd95899a/attachment.html>
Possibly Parallel Threads
- [LLVMdev] Resolving branch instr with label "$BB0_-1"
- [LLVMdev] Resolving branch instr with label "$BB0_-1"
- [LLVMdev] Resolving branch instr with label "$BB0_-1"
- [LLVMdev] Resolving branch instr with label "$BB0_-1"
- [LLVMdev] Resolving branch instr with label "$BB0_-1"