[LLVMdev] Question regarding basic-block placement optimization
Cameron Zwarich
zwarich at apple.com
Tue Oct 18 14:59:48 PDT 2011
On Oct 18, 2011, at 2:53 AM, Chandler Carruth wrote:
> Hello,
>
> I'm working on basic-block placement optimizations based on branch probability information. I've run into a stumbling block though. One of the existing passes to do this, essentially a dead pass 'block-placement' operates on the IR, reordering the blocks of the function, and relying on the code generator to preserve that order unless it has a reason to rearrange it. This pass is entirely untested AFAICT, and it doesn't work any more...
>
> That said, I've replicated its functionality with a much updated transformation algorithm (no longer O(N^2), and finds better orderings!) and predicated it on the new frequency and probability information. It "works" great, but it doesn't actually optimize anything. It re-arranges all the blocks of the IR function, laying them out perfectly. And then the code generation layer throws that away and seems to establish its own ordering altogether.
>
> What's the best approach here? Is ignoring the order of blocks in the IR function desired behavior? (It does seem reasonable, it just seems to have not always been that way, so I wondered.)
>
> Should I sink my pass down to a codegen pass?
I think this should really live as a CodeGen pass. Is there any good reason to make it an IR pass?
Cameron
More information about the llvm-dev
mailing list