[PATCH] D17288: [CodeGenPrepare] Do select to branch transform when cmp's operand is expensive.
Junmo Park via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 17 17:43:35 PST 2016
flyingforyou added a comment.
Sanjay,
> As an example, I don't think this transform or the load transform would help an in-order CPU of any architecture. But we're still doing the transform for those subtargets.
We already consider that we apply "select to branch" opt to for which one.
// Do we have efficient codegen support for this kind of 'selects' ?
if (TLI->isSelectSupported(SelectKind)) {
// We have efficient codegen support for the select instruction.
// Check if it is profitable to keep this 'select'.
if (!TLI->isPredictableSelectExpensive() ||
!isFormingBranchFromSelectProfitable(TTI, SI))
return false;
}
We already check through `TLI->isPredictableSelectExpensive()`. This can be set in X86ISelLowering.cpp.
// A predictable cmov does not hurt on an in-order CPU.
// FIXME: Use a CPU attribute to trigger this, not a CPU model.
PredictableSelectIsExpensive = !Subtarget.isAtom();
If `PredictableSelectIsExpensive ` is not true, we don't transform "select to branch" opt.
And I think we can use `getSchedModel().isOutOfOrder()` for setting the flag `PredictableSelectIsExpensive`.
Junmo.
http://reviews.llvm.org/D17288
More information about the llvm-commits
mailing list