From 188b9fe834a533c9c9e928005c9c0319012692d4 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 25 Mar 2007 01:57:35 +0000 Subject: [PATCH] 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 --- lib/Target/X86/X86ISelLowering.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 2f9763d6f96..3796f3090c7 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(Op)) { - unsigned Value = cast(Op)->getValue(); - if (Value <= 31) + if (ConstantSDNode *C = dyn_cast(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(Op)) { + if (C->getValue() <= 255) + return Op; + } + return SDOperand(0,0); case 'i': // Literal immediates are always ok. if (isa(Op)) return Op; -- 2.34.1