From e074eb265e89922375ed7bb147d90d0a0646e014 Mon Sep 17 00:00:00 2001 From: Niwin Anto Date: Mon, 22 Jul 2024 08:35:50 +0100 Subject: [PATCH] [Technical debt] Remove compiler warnings for unused variable --- llvm/lib/Target/AIE/AIELiveRegs.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/llvm/lib/Target/AIE/AIELiveRegs.cpp b/llvm/lib/Target/AIE/AIELiveRegs.cpp index 6d32d5d56b59..0464b2b08f01 100644 --- a/llvm/lib/Target/AIE/AIELiveRegs.cpp +++ b/llvm/lib/Target/AIE/AIELiveRegs.cpp @@ -53,20 +53,17 @@ void LiveRegs::computeBlockLiveIns(const MachineBasicBlock *MBB, } bool LiveRegs::equal(LivePhysRegs &CurrentLive, LivePhysRegs &OldLive) { - int LiveInCount = 0; - bool Equal = true; - + auto CurrentLiveIt = CurrentLive.begin(); for (const MCPhysReg Reg : OldLive) { if (!CurrentLive.contains(Reg)) { - Equal = false; + return false; } - LiveInCount++; + if (CurrentLiveIt == CurrentLive.end()) + return false; + ++CurrentLiveIt; } - for (const MCPhysReg Reg : CurrentLive) { - LiveInCount--; - } - return LiveInCount == 0 && Equal; + return CurrentLiveIt == CurrentLive.end() ? true : false; } void LiveRegs::updateLiveRegs(LivePhysRegs &CurrentLive,