diff options
author | Chris Lattner <sabre@nondot.org> | 2007-03-25 01:57:35 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-03-25 01:57:35 +0000 |
commit | 188b9fe834a533c9c9e928005c9c0319012692d4 (patch) | |
tree | b7c03f4337207dc7d814693003bc57cef1b6dd20 | |
parent | 7cd5e07f3dfe599b36d43f233c273c4166f6d3af (diff) |
enforce the proper range for the i386 N constraint.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35319 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/X86ISelLowering.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 2f9763d6f9..3796f3090c 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -4544,16 +4544,17 @@ isOperandValidForConstraint(SDOperand Op, char Constraint, SelectionDAG &DAG) { switch (Constraint) { default: break; case 'I': - if (isa<ConstantSDNode>(Op)) { - unsigned Value = cast<ConstantSDNode>(Op)->getValue(); - if (Value <= 31) + if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op)) { + if (C->getValue() <= 31) return Op; - else - return SDOperand(0,0); - } else { - return SDOperand(0,0); } - break; + return SDOperand(0,0); + case 'N': + if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op)) { + if (C->getValue() <= 255) + return Op; + } + return SDOperand(0,0); case 'i': // Literal immediates are always ok. if (isa<ConstantSDNode>(Op)) return Op; |