[PATCH] D106915: Add a DIExpression const-folder to prevent silly expressions

Stephen Tozer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 28 10:04:27 PDT 2021


StephenTozer added a comment.

In D106915#2910494 <https://reviews.llvm.org/D106915#2910494>, @probinson wrote:

> Looking at the rest of the infrastructure, I think the Constant is not optional, the DIExpression is the optional part.  Most of the time there isn't an expression at all, of course, just the initial operand (which might or might not be a Constant).  I suppose that could be redesigned but I think it goes beyond the scope of this patch.

I agree - currently we can't support this, but it can go on the list of potential improvements to DIExpressions.

Some boring nits in the test case, but the implementation looks good. It sounds like some more testing is due, but the rest of this patch LGTM.



================
Comment at: llvm/test/DebugInfo/X86/DIExpr-const-folding.ll:31
+
+attributes #0 = { nofree nosync nounwind readnone speculatable willreturn }
+
----------------
Nit, attribute can be removed.


================
Comment at: llvm/test/DebugInfo/X86/DIExpr-const-folding.ll:37-44
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 13.0.0 (https://github.com/llvm/llvm-project.git 0425332015f479a89226c684c33659aa9cfff4b5)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
+!1 = !DIFile(filename: "min-test-3.cpp", directory: "/home/probinson/projects/scratch/tc8251")
+!2 = !{}
+!3 = !{i32 7, !"Dwarf Version", i32 4}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!5 = !{i32 1, !"wchar_size", i32 4}
+!6 = !{i32 7, !"uwtable", i32 1}
----------------
Nit, git reference can be removed here.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106915/new/

https://reviews.llvm.org/D106915



More information about the llvm-commits mailing list