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

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 16 23:12:53 PST 2022


lkail added a comment.

> Basic idea is to rely on MCSchedModel's MispredictPenalty instead of "hardcoded" TwoEntryPHINodeFoldingThreshold.

Is it appropriate to introduce `MCSchedModel` in simplifycfg?

> 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?


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