[llvm] 9d2181c - [NFC] Reuse DwarfExpression fragment (#210181)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 16 19:03:08 PDT 2026
Author: Eric Christopher
Date: 2026-07-16T19:03:04-07:00
New Revision: 9d2181c78f4e248069e39ec0e5b899dfbfcf3d6a
URL: https://github.com/llvm/llvm-project/commit/9d2181c78f4e248069e39ec0e5b899dfbfcf3d6a
DIFF: https://github.com/llvm/llvm-project/commit/9d2181c78f4e248069e39ec0e5b899dfbfcf3d6a.diff
LOG: [NFC] Reuse DwarfExpression fragment (#210181)
Reuse DwarfExpression fragment information since nothing changes it
between the outside of the loop and the inside of the loop.
Tested via make check.
Assisted by AI.
Added:
Modified:
llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
index f9cc8d176e52b..9b676f88a0cff 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
@@ -325,17 +325,15 @@ bool DwarfExpression::addMachineRegExpression(const TargetRegisterInfo &TRI,
// expression representing a value, rather than a location.
if ((!isParameterValue() && !isMemoryLocation() && !HasComplexExpression) ||
isEntryValue()) {
- auto FragmentInfo = ExprCursor.getFragmentInfo();
unsigned RegSize = 0;
for (auto &Reg : DwarfRegs) {
RegSize += Reg.SubRegSize;
if (Reg.DwarfRegNo >= 0)
addReg(Reg.DwarfRegNo, Reg.Comment);
- if (FragmentInfo)
- if (RegSize > FragmentInfo->SizeInBits)
- // If the register is larger than the current fragment stop
- // once the fragment is covered.
- break;
+ if (Fragment && RegSize > Fragment->SizeInBits)
+ // If the register is larger than the current fragment stop
+ // once the fragment is covered.
+ break;
addOpPiece(Reg.SubRegSize);
}
More information about the llvm-commits
mailing list