[llvm-commits] Speeding up instruction selection

Roman Levenstein romix.llvm at googlemail.com
Thu Mar 6 11:39:25 PST 2008


Hi,

2008/3/6, Chris Lattner <clattner at apple.com>:
>
>  On Mar 6, 2008, at 5:44 AM, Roman Levenstein wrote:
>
>  > Hi,
>  >
>  > One more observation:
>  > For big MBBs (like the one in big4,bc),
>  > llvm::SelectionDAG::ReplaceAllUsesOfValueWith can become a bottleneck
>  > if there are thousends of uses. SDNode.Uses is currently a
>  > small-vector, so that the deletion by means of removeUser is VERY,
>  > VERY slow.
>
>
> If you are interested in this, it would be much better to use a linked
>  data structure like LLVM Value/Use does and MachineRegisterInfo/
>  MachineOperand does.  This allows constant time for all def/use
>  maintenance operations.

OK. But how does it help with removal operations, which is done by
removeUser() function called from ReplaceAllUsesOfValueWith ? In case
of big MBBs, these lists would contain thousends of uses, The big4.bc
contains for example 8000 elements in such a list. So, linear search
would be a disaster here. A sorted list is probably a better
alternative, but may be still slow... So, sets or hash-tables are
better candidates. Or do I miss something?

>
>  > With all my recent changes to ScheduleDAG and instruction selector,
>  > the compilation time for big4.bc went down from 45-50 seconds to 6-9
>  > seconds!!! This is almost a 10 times performance speed-up which makes
>  > the compiler much more scaleable.
>
>
> Nice!  Does it also help more normal cases?  That would be excellent.
How do I test on "normal" cases. For small MBBs everything is so fast,
that it consumes virtually no time. Can you point out some test-cases,
that are big enough to be measurable, but still can be considered
normal?

>  All the work you're doing is also very helpful when we start putting
>  multiple basic blocks at once in a selectiondag.  Thanks for working
>  on this!

I'm glad to contribute!.

-Roman



More information about the llvm-commits mailing list