On Fri, 2 Jun 2006, Fernando Magno Quintao Pereira
wrote:> Dear llvm guys,
>
> I am trying to add the BreakCriticalEdges pass to my application. I
> tried to add it to the PNE pass (e.g. PHIElimination.cpp -
> AU.addRequiredID(BreakCriticalEdgesID); ), but I get this error:
>
> llc -f -regalloc=simple Base1Sum.bc -o simple.s
> -----------------------------------------------
> llc: PassManagerT.h:387: void
> llvm::PassManagerT<Trait>::markPassUsed(const llvm::PassInfo*,
> llvm::Pass*) [with Trait = llvm::MTraits]: Assertion
> `getAnalysisOrNullUp(P) &&
> dynamic_cast<ImmutablePass*>(getAnalysisOrNullUp(P)) &&
"Pass available
> but not found! " "Perhaps this is a module pass requiring a
function
> pass?"' failed.
>
> So, in order to remove the edges, I am first using opt, and after it, I
> run my application, that is called in llc:
>
> opt -break-crit-edges < oldFile.bc > newFile.bc
> llc -f -regalloc=simple newFile.bc -o simple.s
>
> I wish I could add the BreakCriticalEdge pass to the compiler, so it
> would run when I invoked llc. How is the right way of doing this?
There are a couple of problems with this. The specific reason that you're
getting the assertion is because LLVM schedules the critical-edge-breaking
pass before the PHI elimination pass, and LLVM cannot figure out a safe
ordering of passes to get it to work. In particular, something is
probably invalidating the pass before it can be used.
The bigger issue here, however, is that even if LLVM allowed you to do
this, it wouldn't be what you want. This would split the critical edges
of the LLVM CFG, where you (probably) want to split the critical edges of
the machine code CFG.
We don't have any really good facilities for playing around with the
machine code CFG. If you're interested in this, I would suggest
implementing more TargetInstrInfo::xxx hooks. There is already
reverseBranchCondition, it would be straight-forward to add new things.
-Chris
--
http://nondot.org/sabre/
http://llvm.org/