summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-11-18 14:39:03 +0000
committerSanjay Patel <spatel@rotateright.com>2018-11-18 14:39:03 +0000
commit42c22a1f87adf02857245b169d4ec04fca8f153c (patch)
tree0077c2c6f22084d1f9d508d522ed06a57e025501 /llvm
parent7fdbae32245b534159ba8652390d333cc79f256e (diff)
downloadbcm5719-llvm-42c22a1f87adf02857245b169d4ec04fca8f153c.tar.gz
bcm5719-llvm-42c22a1f87adf02857245b169d4ec04fca8f153c.zip
[SelectionDAG] simplify code; NFC
llvm-svn: 347160
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 95e499a8b6a..70958c557f9 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -5078,13 +5078,12 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
break;
}
case ISD::SELECT:
- if (ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1)) {
- if (N1C->getZExtValue())
- return N2; // select true, X, Y -> X
- return N3; // select false, X, Y -> Y
- }
+ // select true, N2, N3 --> N2
+ // select false, N2, N3 --> N3
+ if (auto *N1C = dyn_cast<ConstantSDNode>(N1))
+ return N1C->getZExtValue() ? N2 : N3;
- if (N2 == N3) return N2; // select C, X, X -> X
+ if (N2 == N3) return N2; // select ?, N2, N2 --> N2
break;
case ISD::VECTOR_SHUFFLE:
llvm_unreachable("should use getVectorShuffle constructor!");
OpenPOWER on IntegriCloud