From bcaa0b26aa7c39fc1403e1bb9c2c74f9e7ba704b Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 9 May 2023 13:23:58 -0700 Subject: [PATCH] PrologEpilogInserter: Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds --- llvm/lib/CodeGen/PrologEpilogInserter.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp index e68c30a0aff3..d69bf2f784d4 100644 --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -309,18 +309,18 @@ bool PEI::runOnMachineFunction(MachineFunction &MF) { SpillSize += MFI.getObjectSize(Idx); } - float SpillPct = + [[maybe_unused]] float SpillPct = static_cast(SpillSize) / static_cast(StackSize); - float VarPct = 1.0f - SpillPct; - int64_t VariableSize = StackSize - SpillSize; - LLVM_DEBUG(dbgs() << formatv( - "{0}/{1} ({3:P}) spills, {2}/{1} ({4:P}) variables", - SpillSize, StackSize, VariableSize, SpillPct, VarPct)); + LLVM_DEBUG( + dbgs() << formatv("{0}/{1} ({3:P}) spills, {2}/{1} ({4:P}) variables", + SpillSize, StackSize, StackSize - SpillSize, SpillPct, + 1.0f - SpillPct)); if (UnsafeStackSize != 0) { - float UnsafePct = - static_cast(UnsafeStackSize) / static_cast(StackSize); LLVM_DEBUG(dbgs() << formatv(", {0}/{2} ({1:P}) unsafe stack", - UnsafeStackSize, UnsafePct, StackSize)); + UnsafeStackSize, + static_cast(UnsafeStackSize) / + static_cast(StackSize), + StackSize)); } LLVM_DEBUG(dbgs() << "\n"); }