@@ -3903,7 +3903,8 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
3903
3903
case lltok::kw_mul:
3904
3904
case lltok::kw_shl:
3905
3905
case lltok::kw_lshr:
3906
- case lltok::kw_ashr: {
3906
+ case lltok::kw_ashr:
3907
+ case lltok::kw_xor: {
3907
3908
bool NUW = false ;
3908
3909
bool NSW = false ;
3909
3910
bool Exact = false ;
@@ -3934,34 +3935,13 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
3934
3935
return error (ID.Loc , " operands of constexpr must have same type" );
3935
3936
// Check that the type is valid for the operator.
3936
3937
if (!Val0->getType ()->isIntOrIntVectorTy ())
3937
- return error (ID.Loc , " constexpr requires integer operands" );
3938
+ return error (ID.Loc ,
3939
+ " constexpr requires integer or integer vector operands" );
3938
3940
unsigned Flags = 0 ;
3939
3941
if (NUW) Flags |= OverflowingBinaryOperator::NoUnsignedWrap;
3940
3942
if (NSW) Flags |= OverflowingBinaryOperator::NoSignedWrap;
3941
3943
if (Exact) Flags |= PossiblyExactOperator::IsExact;
3942
- Constant *C = ConstantExpr::get (Opc, Val0, Val1, Flags);
3943
- ID.ConstantVal = C;
3944
- ID.Kind = ValID::t_Constant;
3945
- return false ;
3946
- }
3947
-
3948
- // Logical Operations
3949
- case lltok::kw_xor: {
3950
- unsigned Opc = Lex.getUIntVal ();
3951
- Constant *Val0, *Val1;
3952
- Lex.Lex ();
3953
- if (parseToken (lltok::lparen, " expected '(' in logical constantexpr" ) ||
3954
- parseGlobalTypeAndValue (Val0) ||
3955
- parseToken (lltok::comma, " expected comma in logical constantexpr" ) ||
3956
- parseGlobalTypeAndValue (Val1) ||
3957
- parseToken (lltok::rparen, " expected ')' in logical constantexpr" ))
3958
- return true ;
3959
- if (Val0->getType () != Val1->getType ())
3960
- return error (ID.Loc , " operands of constexpr must have same type" );
3961
- if (!Val0->getType ()->isIntOrIntVectorTy ())
3962
- return error (ID.Loc ,
3963
- " constexpr requires integer or integer vector operands" );
3964
- ID.ConstantVal = ConstantExpr::get (Opc, Val0, Val1);
3944
+ ID.ConstantVal = ConstantExpr::get (Opc, Val0, Val1, Flags);
3965
3945
ID.Kind = ValID::t_Constant;
3966
3946
return false ;
3967
3947
}
0 commit comments