[PATCH] D110558: [DebugInfo][LoopStrengthReduction] Prevent attempts to translate long SCEV expressions

Stephen Tozer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 04:47:35 PDT 2021


StephenTozer accepted this revision.
StephenTozer added a comment.
This revision is now accepted and ready to land.

Two nits, other than that LGTM.



================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:142
+/// Choose a maximum size such that debuginfo is not excessively increased and
+/// sthe salvaging is not too expensive for the compiler.
+static const unsigned MaxSCEVSalvageExpressionSize = 64;
----------------



================
Comment at: llvm/test/Transforms/LoopStrengthReduce/pr51656.ll:77
+  %sub = sub nsw i32 %0, %mul.47, !dbg !40
+  ; CHECK: call void @llvm.dbg.value(metadata !DIArgList(i32 undef, i32 %mul.47), metadata !20, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_minus, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed, DW_OP_stack_value))
+  call void @llvm.dbg.value(metadata i32 %sub, metadata !20, metadata !DIExpression(DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed, DW_OP_stack_value)), !dbg !41
----------------
Just for the sake of resiliency, it would be better to replace the metadata references here with variable matches. So essentially replace `!20` with `![[VAR_E:[0-9]+]]`, and then insert another check directive `![[VAR_E]] = !DILocalVariable(name: "e"` below.


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

https://reviews.llvm.org/D110558



More information about the llvm-commits mailing list