Skip to content

Commit 199117a

Browse files
committed
[X86] Fix error: unused variable 'isMemOp' after llvm#78019, NFCI
BTW, I adjust the code by LLVM coding standards.
1 parent d8ed736 commit 199117a

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

llvm/lib/Target/X86/X86InstrInfo.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3464,11 +3464,9 @@ bool X86::isX87Instruction(MachineInstr &MI) {
34643464
}
34653465

34663466
int X86::getFirstAddrOperandIdx(const MachineInstr &MI) {
3467-
#ifdef EXPENSIVE_CHECKS
3468-
const auto isMemOp = [](const MCOperandInfo &OpInfo) -> bool {
3467+
auto IsMemOp = [](const MCOperandInfo &OpInfo) {
34693468
return OpInfo.OperandType == MCOI::OPERAND_MEMORY;
34703469
};
3471-
#endif
34723470

34733471
const MCInstrDesc &Desc = MI.getDesc();
34743472

@@ -3479,7 +3477,7 @@ int X86::getFirstAddrOperandIdx(const MachineInstr &MI) {
34793477
if (MemRefIdx >= 0)
34803478
return MemRefIdx + X86II::getOperandBias(Desc);
34813479
#ifdef EXPENSIVE_CHECKS
3482-
assert(none_of(Desc.operands(), isMemOp) &&
3480+
assert(none_of(Desc.operands(), IsMemOp) &&
34833481
"Got false negative from X86II::getMemoryOperandNo()!");
34843482
#endif
34853483
return -1;
@@ -3488,9 +3486,10 @@ int X86::getFirstAddrOperandIdx(const MachineInstr &MI) {
34883486
// Otherwise, handle pseudo instructions by examining the type of their
34893487
// operands (slow case). An instruction cannot have a memory reference if it
34903488
// has fewer than AddrNumOperands (= 5) explicit operands.
3491-
if (Desc.getNumOperands() < X86::AddrNumOperands) {
3489+
unsigned NumOps = Desc.getNumOperands();
3490+
if (NumOps < X86::AddrNumOperands) {
34923491
#ifdef EXPENSIVE_CHECKS
3493-
assert(none_of(Desc.operands(), isMemOp) &&
3492+
assert(none_of(Desc.operands(), IsMemOp) &&
34943493
"Expected no operands to have OPERAND_MEMORY type!");
34953494
#endif
34963495
return -1;
@@ -3499,16 +3498,16 @@ int X86::getFirstAddrOperandIdx(const MachineInstr &MI) {
34993498
// The first operand with type OPERAND_MEMORY indicates the start of a memory
35003499
// reference. We expect the following AddrNumOperand-1 operands to also have
35013500
// OPERAND_MEMORY type.
3502-
for (unsigned i = 0; i <= Desc.getNumOperands() - X86::AddrNumOperands; ++i) {
3503-
if (Desc.operands()[i].OperandType == MCOI::OPERAND_MEMORY) {
3501+
for (unsigned I = 0, E = NumOps - X86::AddrNumOperands; I != E; ++I) {
3502+
if (IsMemOp(Desc.operands()[I])) {
35043503
#ifdef EXPENSIVE_CHECKS
3505-
assert(std::all_of(Desc.operands().begin() + i,
3506-
Desc.operands().begin() + i + X86::AddrNumOperands,
3507-
isMemOp) &&
3504+
assert(std::all_of(Desc.operands().begin() + I,
3505+
Desc.operands().begin() + I + X86::AddrNumOperands,
3506+
IsMemOp) &&
35083507
"Expected all five operands in the memory reference to have "
35093508
"OPERAND_MEMORY type!");
35103509
#endif
3511-
return i;
3510+
return I;
35123511
}
35133512
}
35143513

0 commit comments

Comments
 (0)