[llvm] [DebugInfo][JumpThreading] Fix missing debug location updates (PR #91581)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 07:16:10 PDT 2024


================
@@ -33,8 +36,9 @@ define i32 @branch_implies_guard(i32 %a) !dbg !7 {
 ; CHECK-NEXT:    br label [[MERGE]]
 ; CHECK:       Merge:
 ; CHECK-NEXT:    [[RETPHI:%.*]] = phi i32 [ [[V1]], [[T1_SPLIT]] ], [ [[V2]], [[F1_SPLIT]] ]
-; CHECK-NEXT:    [[TMP1:%.*]] = phi i32 [ [[RETVAL3]], [[T1_SPLIT]] ], [ [[RETVAL1]], [[F1_SPLIT]] ]
+; CHECK-NEXT:    [[TMP1:%.*]] = phi i32 [ [[RETVAL3]], [[T1_SPLIT]] ], [ [[RETVAL1]], [[F1_SPLIT]] ], !dbg [[DBG12]]
 ; CHECK-NEXT:    ret i32 [[TMP1]], !dbg [[DBG12]]
+; CHECK: [[DBG12]] = !DILocation(line: 13,
----------------
OCHyams wrote:

The same concern mentioned below about auto-generated checks applies to this test. The problem is that this test is marked as auto generated so someone might re-generate the test in the future. In this case this would result in a loss of test coverage because the regenerated test would not include your `CHECK: [[DBG12]] = ...` directive.

IMO there are a couple of options to choose from:
1.  Use this file but check metadata too by using the update_test_checks.py argument `--check-globals` 
2. Duplicate this test file, then in the new file remove the "auto-generated" line at the top and the CHECK directives we don't need, and add your new CHECK(s).
3. Use this file but remove the "auto-generated" line at the top.

Those options are more or less in my order of preference, if option 1 doesn't add too much noise to the test - could you try that out?

https://github.com/llvm/llvm-project/pull/91581


More information about the llvm-commits mailing list