[all-commits] [llvm/llvm-project] a08a83: [DLCov][NFC] Propagate annotated DebugLocs through...

Stephen Tozer via All-commits all-commits at lists.llvm.org
Thu Jun 12 06:06:49 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a08a831515919bcc384b453799f33bc97860c73b
      https://github.com/llvm/llvm-project/commit/a08a831515919bcc384b453799f33bc97860c73b
  Author: Stephen Tozer <stephen.tozer at sony.com>
  Date:   2025-06-12 (Thu, 12 Jun 2025)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
    M llvm/include/llvm/IR/DebugInfoMetadata.h
    M llvm/include/llvm/IR/DebugLoc.h
    M llvm/include/llvm/IR/IRBuilder.h
    M llvm/include/llvm/IR/Instruction.h
    M llvm/lib/CodeGen/BranchFolding.cpp
    M llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp
    M llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp
    M llvm/lib/CodeGen/MachineBasicBlock.cpp
    M llvm/lib/CodeGen/MachineSink.cpp
    M llvm/lib/IR/DebugInfo.cpp
    M llvm/lib/IR/DebugLoc.cpp
    M llvm/lib/IR/IRBuilder.cpp
    M llvm/lib/IR/Instruction.cpp
    M llvm/lib/Target/BPF/BPFPreserveStaticOffset.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
    M llvm/lib/Transforms/Scalar/LICM.cpp
    M llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/lib/Transforms/Vectorize/VPlan.cpp

  Log Message:
  -----------
  [DLCov][NFC] Propagate annotated DebugLocs through transformations (#138047)

Part of the coverage-tracking feature, following #107279.

In order for DebugLoc coverage testing to work, we firstly have to set
annotations for intentionally-empty DebugLocs, and secondly we have to
ensure that we do not drop these annotations as we propagate DebugLocs
throughout compilation. As the annotations exist as part of the DebugLoc
class, and not the underlying DILocation, they will not survive a
DebugLoc->DILocation->DebugLoc roundtrip. Therefore this patch modifies
a number of places in the compiler to propagate DebugLocs directly
rather than via the underlying DILocation. This has no effect on the
output of normal builds; it only ensures that during coverage builds, we
do not drop incorrectly annotations and therefore create false
positives.

The bulk of these changes are in replacing
DILocation::getMergedLocation(s) with a DebugLoc equivalent, and in
changing the IRBuilder to store a DebugLoc directly rather than storing
DILocations in its general Metadata array. We also use a new function,
`DebugLoc::orElse`, which selects the "best" DebugLoc out of a pair
(valid location > annotated > empty), preferring the current DebugLoc on
a tie - this encapsulates the existing behaviour at a few sites where we
_may_ assign a DebugLoc to an existing instruction, while extending the
logic to handle annotation DebugLocs at the same time.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list