[PATCH] D44814: [CodeGenPrepare] Split huge basic blocks for faster compilation.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 23 12:19:44 PDT 2018
efriedma added a comment.
> What would be a better way to get BB size?
Given your algorithm, I don't understand why you need to get the BB size in the first place; you can just iterate over every block, and split when you hit the threshold.
> Correct, in the current shape the patch aims only at -Os. Do you think it would be better to have a separate pass for it and schedule it at O0 too?
The key question is whether we're using SelectionDAG ISel, since the blocks will be un-split after ISel anyway. We don't use SelectionDAG ISel for most blocks at -O0, but we for a few. Maybe not worth worrying about.
================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:491
+ unsigned n = 0;
+ for (Instruction &I : *BB) {
+ if (n == BasicBlockMaxSize) {
----------------
You probably need to skip over all PHI nodes/landingpads/etc. so you don't try to split a block in an impossible place. And I think some Windows exception-handling blocks can't be split? (It would be unusual to have a block with over 1000 PHI nodes, but not impossible.)
And like I mentioned before, you need to skip debug into intrinsics.
This should have a testcase to exercise this logic (you can mess with the threshold to keep the testcase small).
Repository:
rL LLVM
https://reviews.llvm.org/D44814
More information about the llvm-commits
mailing list