[PATCH] D113872: [CGP] Handle select instructions relying on the same condition

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 17 02:52:54 PST 2022


lebedev.ri added a comment.

In D113872#3247529 <https://reviews.llvm.org/D113872#3247529>, @lkail wrote:

>> Basic idea is to rely on MCSchedModel's MispredictPenalty instead of "hardcoded" TwoEntryPHINodeFoldingThreshold.
>
> Is it appropriate to introduce `MCSchedModel` in simplifycfg?

If it's properly exposed via TTI, should be fine i guess.
I'll try to look into simplifycfg stuff.

>> because it is not generally correct to consider that the latency of two instructions is a sum of their latencies, because they could be independent and could have been executed in parallel.
>
> Good point.



> Another point I have missed in the patch is what if some `select`s can't be lowered to corresponding target's conditional move finally, like `cmove` in x86, `isel` in ppc. In ppc, we don't have legal operation for `ISD::Select` on float types. This looks breaking the consistency between costmodel in LLVM IR and final assembly. Does this also imply we can't handle branch -> select precisely in simplifycfg?

I would guess `TTI::getSelectCost()` should have a parameter with type of the operands being selected.

But regardless of what happens in simplifycfg, it sounds like ppc should have it's own version of X86CmovConversion, if it doesn't already.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113872/new/

https://reviews.llvm.org/D113872



More information about the llvm-commits mailing list