[llvm] [DebugInfo] Accept DW_OP_xderef_size and DW_OP_lit1..DW_OP_lit31. (PR #227839)
Matt Davis via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 6 04:04:38 PDT 2026
================
@@ -1798,15 +1799,19 @@ bool DIExpression::PlusUconstOp::classof(const ExprOperand *Op) {
return Op->is(dwarf::DW_OP_plus_uconst);
}
+bool DIExpression::isLitOp(uint64_t Op) {
+ return Op >= dwarf::DW_OP_lit0 && Op <= dwarf::DW_OP_lit31;
+}
+
bool DIExpression::isValid() const {
for (auto I = expr_op_begin(), E = expr_op_end(); I != E; ++I) {
// Check that there's space for the operand.
- if (I->get() + I->getSize() > E->get())
+ if (I->getSize() > static_cast<uint64_t>(E->get() - I->get()))
----------------
enferex wrote:
> Did you consider using constu throughtout compilation, and just optimizing to litN in AsmPrinter? It seems like we would want to always use the smallest semantically equivalent sequence anyway, and it avoids the need to recognize/normalize both forms throughout compilation
No, I did not consider that. Since there was already a presidence for lit0 in the `DIExpression::isValid`, it seemed logical to complete the support earlier in the pipeline.
https://github.com/llvm/llvm-project/pull/227839
More information about the llvm-commits
mailing list