Before we speculatively execute a basic block, query the cost of inserting the necessary select instructions against the phi folding threshold. For non-trivial insertions, a more accurate decision can probably be made during machine if-conversion.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/Transforms/SimplifyCFG/ARM/select-costs.ll | ||
---|---|---|
87 | Can you cleanup/reduce this test case any further? |
llvm/lib/Transforms/Utils/SimplifyCFG.cpp | ||
---|---|---|
1994 | Hmm, I hadn't noticed that. Certainly happy to look into that next. |
llvm/test/Transforms/SimplifyCFG/ARM/select-costs.ll | ||
---|---|---|
4 | I think it would be good to also add a triple for which we hoist the code, to ensure the test keeps testing what we want. |
llvm/test/Transforms/SimplifyCFG/ARM/select-costs.ll | ||
---|---|---|
1 | I also don't quite get what this is about. I'd suggest the following:
|
@mkazantsev I made a change before committing this, as I modified the patch that this depended upon. I've now added logic to query for CodeSize instead of SizeAndLatency when we have minsize as well as adding a minsize test so the logic is still tested.
I guess it's an improvement for ARM, but the cost-modelling still looks bogus to me there.
It defies the point. We should calculate the single total cost of speculation,
and compare it once with the threshold, not compute parts of the cost
and compare them separately with the threshold each time.
llvm/lib/Transforms/Utils/SimplifyCFG.cpp | ||
---|---|---|
2107–2108 | here too | |
2165–2170 | and here |
I agree and I'm just about to upload a couple more patches, one to cover the points you just raised.
I do not understand what is going on in this function.
Why are we comparing each separate cost with threshold,
instead of accumulating the costs and comparing that?