Skip to content

Commit

Permalink
[LLParser] Remove unnecessary switch from the handling of the remaini… (
Browse files Browse the repository at this point in the history
#67362)

…ng binary constantexprs.

FP binary operators aren't supported anymore, so we don't need a switch
to pick whether we expect an integer or FP type.
  • Loading branch information
topperc committed Sep 25, 2023
1 parent d3505c2 commit d034c18
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions llvm/lib/AsmParser/LLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3933,30 +3933,8 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
if (Val0->getType() != Val1->getType())
return error(ID.Loc, "operands of constexpr must have same type");
// Check that the type is valid for the operator.
switch (Opc) {
case Instruction::Add:
case Instruction::Sub:
case Instruction::Mul:
case Instruction::UDiv:
case Instruction::SDiv:
case Instruction::URem:
case Instruction::SRem:
case Instruction::Shl:
case Instruction::AShr:
case Instruction::LShr:
if (!Val0->getType()->isIntOrIntVectorTy())
return error(ID.Loc, "constexpr requires integer operands");
break;
case Instruction::FAdd:
case Instruction::FSub:
case Instruction::FMul:
case Instruction::FDiv:
case Instruction::FRem:
if (!Val0->getType()->isFPOrFPVectorTy())
return error(ID.Loc, "constexpr requires fp operands");
break;
default: llvm_unreachable("Unknown binary operator!");
}
if (!Val0->getType()->isIntOrIntVectorTy())
return error(ID.Loc, "constexpr requires integer operands");
unsigned Flags = 0;
if (NUW) Flags |= OverflowingBinaryOperator::NoUnsignedWrap;
if (NSW) Flags |= OverflowingBinaryOperator::NoSignedWrap;
Expand Down

0 comments on commit d034c18

Please sign in to comment.