diff options
| author | Craig Topper <craig.topper@intel.com> | 2019-10-13 06:48:05 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@intel.com> | 2019-10-13 06:48:05 +0000 |
| commit | d50cb9ac8ca1ea266751c42b8f6c74fa82a0944a (patch) | |
| tree | be5c7c68d0d3d698541d3092841d45c2d59368e9 /llvm/lib/Target | |
| parent | bf57aa2b25c54a30246cd87addfdb90529908fd3 (diff) | |
| download | bcm5719-llvm-d50cb9ac8ca1ea266751c42b8f6c74fa82a0944a.tar.gz bcm5719-llvm-d50cb9ac8ca1ea266751c42b8f6c74fa82a0944a.zip | |
[X86] Add a one use check on the setcc to the min/max canonicalization code in combineSelect.
This seems to improve std::midpoint code where we have a min and
a max with the same condition. If we split the setcc we can end
up with two compares if the one of the operands is a constant.
Since we aggressively canonicalize compares with constants.
For non-constants it can interfere with our ability to share
control flow if we need to expand cmovs into control flow.
I'm also not sure I understand this min/max canonicalization code.
The motivating case talks about comparing with 0. But we don't
check for 0 explicitly.
Removes one instruction from the codegen for PR43658.
llvm-svn: 374706
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 8d538198aef..58cf9bd5174 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -37009,6 +37009,7 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &DAG, // subl %esi, $edi // cmovsl %eax, %edi if (N->getOpcode() == ISD::SELECT && Cond.getOpcode() == ISD::SETCC && + Cond.hasOneUse() && DAG.isEqualTo(LHS, Cond.getOperand(0)) && DAG.isEqualTo(RHS, Cond.getOperand(1))) { ISD::CondCode CC = cast<CondCodeSDNode>(Cond.getOperand(2))->get(); |

