Skip to content
This repository was archived by the owner on Sep 2, 2018. It is now read-only.

Commit 8a22bb7

Browse files
author
rksimon
committed
[DAGCombiner] Just call isConstOrConstSplat directly. NFCI.
This will get the same ConstantSDNode scalar or vector splat value as the current separate dyn_cast<ConstantSDNode> / isVector() approach. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284578 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 6886851 commit 8a22bb7

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4704,13 +4704,11 @@ SDValue DAGCombiner::visitSRA(SDNode *N) {
47044704
return N0;
47054705

47064706
// fold vector ops
4707-
ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1);
4708-
if (VT.isVector()) {
4707+
if (VT.isVector())
47094708
if (SDValue FoldedVOp = SimplifyVBinOp(N))
47104709
return FoldedVOp;
47114710

4712-
N1C = isConstOrConstSplat(N1);
4713-
}
4711+
ConstantSDNode *N1C = isConstOrConstSplat(N1);
47144712

47154713
// fold (sra c1, c2) -> (sra c1, c2)
47164714
ConstantSDNode *N0C = getAsNonOpaqueConstant(N0);
@@ -4856,13 +4854,11 @@ SDValue DAGCombiner::visitSRL(SDNode *N) {
48564854
unsigned OpSizeInBits = VT.getScalarSizeInBits();
48574855

48584856
// fold vector ops
4859-
ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1);
4860-
if (VT.isVector()) {
4857+
if (VT.isVector())
48614858
if (SDValue FoldedVOp = SimplifyVBinOp(N))
48624859
return FoldedVOp;
48634860

4864-
N1C = isConstOrConstSplat(N1);
4865-
}
4861+
ConstantSDNode *N1C = isConstOrConstSplat(N1);
48664862

48674863
// fold (srl c1, c2) -> c1 >>u c2
48684864
ConstantSDNode *N0C = getAsNonOpaqueConstant(N0);

0 commit comments

Comments
 (0)