forked from OSchip/llvm-project
[X86] Use cast instead of dyn_cast and a null check marked unreachable.
llvm-svn: 251774
This commit is contained in:
parent
a8d0be0cd6
commit
d49a41793c
|
@ -16653,9 +16653,7 @@ static SDValue getGatherNode(unsigned Opc, SDValue Op, SelectionDAG &DAG,
|
|||
SDValue Index, SDValue ScaleOp, SDValue Chain,
|
||||
const X86Subtarget * Subtarget) {
|
||||
SDLoc dl(Op);
|
||||
ConstantSDNode *C = dyn_cast<ConstantSDNode>(ScaleOp);
|
||||
if (!C)
|
||||
llvm_unreachable("Invalid scale type");
|
||||
auto *C = cast<ConstantSDNode>(ScaleOp);
|
||||
unsigned ScaleVal = C->getZExtValue();
|
||||
if (ScaleVal > 2 && ScaleVal != 4 && ScaleVal != 8)
|
||||
llvm_unreachable("Valid scale values are 1, 2, 4, 8");
|
||||
|
@ -16692,9 +16690,7 @@ static SDValue getScatterNode(unsigned Opc, SDValue Op, SelectionDAG &DAG,
|
|||
SDValue Src, SDValue Mask, SDValue Base,
|
||||
SDValue Index, SDValue ScaleOp, SDValue Chain) {
|
||||
SDLoc dl(Op);
|
||||
ConstantSDNode *C = dyn_cast<ConstantSDNode>(ScaleOp);
|
||||
if (!C)
|
||||
llvm_unreachable("Invalid scale type");
|
||||
auto *C = cast<ConstantSDNode>(ScaleOp);
|
||||
unsigned ScaleVal = C->getZExtValue();
|
||||
if (ScaleVal > 2 && ScaleVal != 4 && ScaleVal != 8)
|
||||
llvm_unreachable("Valid scale values are 1, 2, 4, 8");
|
||||
|
@ -16728,8 +16724,7 @@ static SDValue getPrefetchNode(unsigned Opc, SDValue Op, SelectionDAG &DAG,
|
|||
SDValue Mask, SDValue Base, SDValue Index,
|
||||
SDValue ScaleOp, SDValue Chain) {
|
||||
SDLoc dl(Op);
|
||||
ConstantSDNode *C = dyn_cast<ConstantSDNode>(ScaleOp);
|
||||
assert(C && "Invalid scale type");
|
||||
auto *C = cast<ConstantSDNode>(ScaleOp);
|
||||
SDValue Scale = DAG.getTargetConstant(C->getZExtValue(), dl, MVT::i8);
|
||||
SDValue Disp = DAG.getTargetConstant(0, dl, MVT::i32);
|
||||
SDValue Segment = DAG.getRegister(0, MVT::i32);
|
||||
|
|
Loading…
Reference in New Issue