[all-commits] [llvm/llvm-project] fe0e5b: [Polly] Insert !dbg metadata for emitted CallInsts.

Michael Kruse via All-commits all-commits at lists.llvm.org
Tue Jul 26 17:45:09 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fe0e5b3e43b7326ddce7bb5fc381ecbbc786a797
      https://github.com/llvm/llvm-project/commit/fe0e5b3e43b7326ddce7bb5fc381ecbbc786a797
  Author: Michael Kruse <llvm-project at meinersbur.de>
  Date:   2022-07-26 (Tue, 26 Jul 2022)

  Changed paths:
    M polly/include/polly/CodeGen/LoopGenerators.h
    M polly/lib/CodeGen/LoopGenerators.cpp
    M polly/lib/CodeGen/LoopGeneratorsGOMP.cpp
    M polly/lib/CodeGen/LoopGeneratorsKMP.cpp
    A polly/test/CodeGen/issue56692.ll

  Log Message:
  -----------
  [Polly] Insert !dbg metadata for emitted CallInsts.

The IR Verifier requires that every call instruction to an inlineable
function (among other things, its implementation must be visible in the
translation unit) must also have !dbg metadata attached to it. When
parallelizing, Polly emits calls to OpenMP runtime function out of thin
air, or at least not directly derived from a bounded list of previous
instruction. While we could search for instructions in the SCoP that has
some debug info attached to it, there is no guarantee that we find any.
Our solution is to generate a new DILocation that points to line 0 to
represent optimized code.

The OpenMP function implementation is usually not available in the
user's translation unit, but can become visible in an LTO build. For
the bug to appear, libomp must also be built with debug symbols.

IMHO, the IR verifier rule is too strict. Runtime functions can
also be inserted by other optimization passes, such as
LoopIdiomRecognize. When inserting a call to e.g. memset, it uses the
DebugLoc from a StoreInst from the unoptimized code. It is not
required to have !dbg metadata attached either.

Fixes #56692




More information about the All-commits mailing list