Changeset View
Standalone View
test/Transforms/InstCombine/debuginfo-trunc-and-zext.ll
- This file was added.
; ModuleID = 'debuginfo-trunc-and-zext.ll' | |||||
lebedev.ri: This does not actually check anything, there is no `RUN` line. | |||||
vskUnsubmitted Right. When you add a run line, please reduce this test by invoking opt -debugify, instead of checking in unnecessary metadata lines. vsk: Right. When you add a run line, please reduce this test by invoking `opt -debugify`, instead of… | |||||
bjopeUnsubmitted Not Done ReplyInline ActionsIs that really a good idea?
bjope: Is that really a good idea?
1) It is really hard to review this without knowing what the input… | |||||
vskUnsubmitted Not Done ReplyInline ActionsThe basic requirement of -debugify output is that it must be stable enough to use in regression tests. Just to recap, a dbg.value is inserted after each non-void-valued instruction if the insertion point is valid, and the variable names are sequential integers. Occasionally -debugify requires bug fixes, but these changes aren't allowed to break existing tests or to change their meaning. I hope that addresses your first and second concerns? It does take some extra effort initially to understand this style of test, but I think that effort pays off. Concretely, the advantage of using -debugify in regression tests is that it lets us test an optimization in the exact same place as the optimization's ability to preserve debug info. This makes it easier to keep debug info tests in sync with the behavior of an optimization. And it makes it much easier to add tests by lessening the need for manual reduction, which is a barrier to contribution. To your third point, you're right that -debugify inserts more debug info than strictly needed, but we can avoid confusion here by using strict CHECK lines. vsk: The basic requirement of -debugify output is that it must be stable enough to use in regression… | |||||
bjopeUnsubmitted Not Done ReplyInline ActionsSo the size of the variable always matches the value exactly? Anyway, my main concern is that it will be really hard to review patches like this one. without knowing what the input looks like. But maybe that is obvious after playing around with debugify for some hours. bjope: So the size of the variable always matches the value exactly?
And it will never happen that… | |||||
bjopeUnsubmitted Not Done ReplyInline Actions
I guess there is a test case for the optimization somewhere, is the idea that this test shouuld be added as an extra RUN line in that test case instead of adding a new file? bjope: > Concretely, the advantage of using -debugify in regression tests is that it lets us test an… | |||||
vskUnsubmitted Not Done ReplyInline Actions
Yes, specifically, DataLayout::getTypeAllocSizeInBits is used for sized types.
I view these specific changes as a bit out of scope for -debugify, but regardless, it's possible to write regression tests which don't depend on these details.
I'm.. growing increasingly concerned about this as well. I'd like our tests to be reasonably simple to understand. My view is that these tests already require understanding of at least one pass (in this case -instcombine), so it's reasonable to depend on a stable testing pass on top of that. That could well be too optimistic. How much extra effort is involved in parsing this test? Would more documentation help? (Anyone else have thoughts about this?)
Ideally yes. If you grep in tests/Transforms you'll see this pattern used to test gvn, *dce, sccp, licm etc. I would like this patch to adopt the same approach, similar to https://reviews.llvm.org/D48640. vsk: > So the size of the variable always matches the value exactly?
Yes, specifically, DataLayout… | |||||
bjopeUnsubmitted Not Done ReplyInline Actionsbjope: Ok, I think I got it. Thanks to @vsk for the explanations! And sorry @gramanas for having this… | |||||
gramanasAuthorUnsubmitted Not Done ReplyInline ActionsIt's not a problem at all. Thanks for your comments, any feedback is welcomed.
Indeed the test should get incorporated with already existing tests. I will work on that.
I think the -debugify pass is pretty simple to understand, but some documentation would definitely help future devs who come across this kind of tests, or would like to add similar tests to other passes. Since getting the -debugify output is just an opt invocation away, I think it's better to write tests like this instead of incorporating the debug info in the .ll file which results in clutter. gramanas: It's not a problem at all. Thanks for your comments, any feedback is welcomed.
> I would like… | |||||
source_filename = "debuginfo-trunc-and-zext.ll" | |||||
define <2 x i64> @test3(<2 x i64> %A) !dbg !6 { | |||||
%trunc = trunc <2 x i64> %A to <2 x i32>, !dbg !14 | |||||
call void @llvm.dbg.value(metadata <2 x i32> %trunc, metadata !9, metadata !DIExpression()), !dbg !14 | |||||
%and = and <2 x i32> %trunc, <i32 23, i32 42>, !dbg !15 | |||||
call void @llvm.dbg.value(metadata <2 x i32> %and, metadata !11, metadata !DIExpression()), !dbg !15 | |||||
%zext = zext <2 x i32> %and to <2 x i64>, !dbg !16 | |||||
call void @llvm.dbg.value(metadata <2 x i64> %zext, metadata !12, metadata !DIExpression()), !dbg !16 | |||||
ret <2 x i64> %zext, !dbg !17 | |||||
} | |||||
; Function Attrs: nounwind readnone speculatable | |||||
declare void @llvm.dbg.value(metadata, metadata, metadata) #0 | |||||
Not Done ReplyInline ActionsThis only check for the existence of three dbginfo's. lebedev.ri: This only check for the existence of three dbginfo's.
I wonder how much noise would the… | |||||
attributes #0 = { nounwind readnone speculatable } | |||||
Not Done ReplyInline ActionsPlease move the check line closer to the associated IR. You can pick whether to add the checks after the associated IR lines or before. So: ; CHECK-LABEL: define i32 @test-scalar define i32 @test-scalar(i32 %x, i32 %y) { etc. vsk: Please move the check line closer to the associated IR. You can pick whether to add the checks… | |||||
!llvm.dbg.cu = !{!0} | |||||
Not Done ReplyInline ActionsThis just tests that there are some dbg.values. Please make the test more specific by checking that the operand of the dbg.value is correct. vsk: This just tests that there are some dbg.values. Please make the test more specific by checking… | |||||
!llvm.debugify = !{!3, !4} | |||||
!llvm.module.flags = !{!5} | |||||
!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) | |||||
!1 = !DIFile(filename: "debuginfo-trunc-and-zext.ll", directory: "/") | |||||
!2 = !{} | |||||
!3 = !{i32 4} | |||||
!4 = !{i32 3} | |||||
!5 = !{i32 2, !"Debug Info Version", i32 3} | |||||
!6 = distinct !DISubprogram(name: "test3", linkageName: "test3", scope: null, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !8) | |||||
!7 = !DISubroutineType(types: !2) | |||||
!8 = !{!9, !11, !12} | |||||
!9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10) | |||||
!10 = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_unsigned) | |||||
!11 = !DILocalVariable(name: "2", scope: !6, file: !1, line: 2, type: !10) | |||||
!12 = !DILocalVariable(name: "3", scope: !6, file: !1, line: 3, type: !13) | |||||
!13 = !DIBasicType(name: "ty128", size: 128, encoding: DW_ATE_unsigned) | |||||
!14 = !DILocation(line: 1, column: 1, scope: !6) | |||||
!15 = !DILocation(line: 2, column: 1, scope: !6) | |||||
!16 = !DILocation(line: 3, column: 1, scope: !6) | |||||
!17 = !DILocation(line: 4, column: 1, scope: !6) |
This does not actually check anything, there is no RUN line.