Skip to content

Commit a32d491

Browse files
committed
[RISCV] Clean up the code for isBareSimmNLsb0. NFC.
1 parent ebba554 commit a32d491

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -539,17 +539,16 @@ struct RISCVOperand final : public MCParsedAsmOperand {
539539
// True if operand is a symbol with no modifiers, or a constant with no
540540
// modifiers and isShiftedInt<N-1, 1>(Op).
541541
template <int N> bool isBareSimmNLsb0() const {
542-
int64_t Imm;
543-
RISCVMCExpr::Specifier VK = RISCVMCExpr::VK_None;
544542
if (!isImm())
545543
return false;
546-
bool IsConstantImm = evaluateConstantImm(getImm(), Imm);
547-
bool IsValid;
548-
if (!IsConstantImm)
549-
IsValid = RISCVAsmParser::classifySymbolRef(getImm(), VK);
550-
else
551-
IsValid = isShiftedInt<N - 1, 1>(fixImmediateForRV32(Imm, isRV64Imm()));
552-
return IsValid && VK == RISCVMCExpr::VK_None;
544+
545+
int64_t Imm;
546+
if (evaluateConstantImm(getImm(), Imm))
547+
return isShiftedInt<N - 1, 1>(fixImmediateForRV32(Imm, isRV64Imm()));
548+
549+
RISCVMCExpr::Specifier VK = RISCVMCExpr::VK_None;
550+
return RISCVAsmParser::classifySymbolRef(getImm(), VK) &&
551+
VK == RISCVMCExpr::VK_None;
553552
}
554553

555554
// True if operand is a symbol with no modifiers, or a constant with no

0 commit comments

Comments
 (0)