[llvm] r347160 - [SelectionDAG] simplify code; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 18 06:39:03 PST 2018
Author: spatel
Date: Sun Nov 18 06:39:03 2018
New Revision: 347160
URL: http://llvm.org/viewvc/llvm-project?rev=347160&view=rev
Log:
[SelectionDAG] simplify code; NFC
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=347160&r1=347159&r2=347160&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Nov 18 06:39:03 2018
@@ -5078,13 +5078,12 @@ SDValue SelectionDAG::getNode(unsigned O
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!");
More information about the llvm-commits
mailing list