[all-commits] [llvm/llvm-project] a253a0: Avoid removing useful loop metadata when stripping...

Dongrui She via All-commits all-commits at lists.llvm.org
Wed Jan 25 10:05:44 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a253a0bbe5ece7795633f8abeba7786e98a3e875
      https://github.com/llvm/llvm-project/commit/a253a0bbe5ece7795633f8abeba7786e98a3e875
  Author: She Dongrui <dongrui.she at intel.com>
  Date:   2023-01-25 (Wed, 25 Jan 2023)

  Changed paths:
    M llvm/lib/IR/DebugInfo.cpp
    A llvm/test/Verifier/llvm.loop-cu-strip-followup.ll
    M llvm/test/Verifier/llvm.loop-cu-strip-indirect.ll

  Log Message:
  -----------
  Avoid removing useful loop metadata when stripping debug info

The stripDebugLocFromLoopID() may mistakenly remove useful metadata nodes
when they are operands of a child node, which also has DILocation operands.

It can be reproduced by the output of clang for code similar to the following:

for(int i = 0; i < n; i++)
  x[i] = 10;
-strip-debug removes the child node of llvm.loop.vectorize.followup_all,
which contains llvm.loop.isvectorized and llvm.loop.unroll.count.

This patch fixes by checking all children nodes and only remove a metadata
node if all its children are DILocation.

Differential Revision: https://reviews.llvm.org/D141909




More information about the All-commits mailing list