[llvm] r251774 - [X86] Use cast instead of dyn_cast and a null check marked unreachable.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 1 23:24:25 PST 2015
Author: ctopper
Date: Mon Nov 2 01:24:25 2015
New Revision: 251774
URL: http://llvm.org/viewvc/llvm-project?rev=251774&view=rev
Log:
[X86] Use cast instead of dyn_cast and a null check marked unreachable.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=251774&r1=251773&r2=251774&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Nov 2 01:24:25 2015
@@ -16653,9 +16653,7 @@ static SDValue getGatherNode(unsigned Op
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 O
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
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);
More information about the llvm-commits
mailing list