forked from OSchip/llvm-project
Use dyn_cast instead of isa and cast.
No functionality change. llvm-svn: 164924
This commit is contained in:
parent
f064b65a94
commit
ec5a2f248f
|
@ -136,13 +136,11 @@ bool ISD::isBuildVectorAllOnes(const SDNode *N) {
|
||||||
// constants are.
|
// constants are.
|
||||||
SDValue NotZero = N->getOperand(i);
|
SDValue NotZero = N->getOperand(i);
|
||||||
unsigned EltSize = N->getValueType(0).getVectorElementType().getSizeInBits();
|
unsigned EltSize = N->getValueType(0).getVectorElementType().getSizeInBits();
|
||||||
if (isa<ConstantSDNode>(NotZero)) {
|
if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(NotZero)) {
|
||||||
if (cast<ConstantSDNode>(NotZero)->getAPIntValue().countTrailingOnes() <
|
if (CN->getAPIntValue().countTrailingOnes() < EltSize)
|
||||||
EltSize)
|
|
||||||
return false;
|
return false;
|
||||||
} else if (isa<ConstantFPSDNode>(NotZero)) {
|
} else if (ConstantFPSDNode *CFPN = dyn_cast<ConstantFPSDNode>(NotZero)) {
|
||||||
if (cast<ConstantFPSDNode>(NotZero)->getValueAPF()
|
if (CFPN->getValueAPF().bitcastToAPInt().countTrailingOnes() < EltSize)
|
||||||
.bitcastToAPInt().countTrailingOnes() < EltSize)
|
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
@ -179,11 +177,11 @@ bool ISD::isBuildVectorAllZeros(const SDNode *N) {
|
||||||
// Do not accept build_vectors that aren't all constants or which have non-0
|
// Do not accept build_vectors that aren't all constants or which have non-0
|
||||||
// elements.
|
// elements.
|
||||||
SDValue Zero = N->getOperand(i);
|
SDValue Zero = N->getOperand(i);
|
||||||
if (isa<ConstantSDNode>(Zero)) {
|
if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Zero)) {
|
||||||
if (!cast<ConstantSDNode>(Zero)->isNullValue())
|
if (!CN->isNullValue())
|
||||||
return false;
|
return false;
|
||||||
} else if (isa<ConstantFPSDNode>(Zero)) {
|
} else if (ConstantFPSDNode *CFPN = dyn_cast<ConstantFPSDNode>(Zero)) {
|
||||||
if (!cast<ConstantFPSDNode>(Zero)->getValueAPF().isPosZero())
|
if (!CFPN->getValueAPF().isPosZero())
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue