[PATCH] D16836: [CodeGenPrepare] Don't transform select instructions into branches when both of operands are cheap
Junmo Park via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 17 17:54:33 PST 2016
flyingforyou added a comment.
Hi Gerolf.
Below is what I answered about Sanjay's opinion in http://reviews.llvm.org/D17288. I think this could be answer about your opinion also.
We already consider that we apply "select to branch opt" 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/D16836
More information about the llvm-commits
mailing list