This is an archive of the discontinued LLVM Phabricator instance.

Avoid removing useful loop metadata when striping debug info
ClosedPublic

Authored by dongrui on Jan 17 2023, 2:43 AM.

Details

Summary

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:

#pragma clang loop unroll_count(4)
#pragma clang loop vectorize(assume_safety)
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.

Diff Detail

Event Timeline

dongrui created this revision.Jan 17 2023, 2:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 17 2023, 2:43 AM
dongrui requested review of this revision.Jan 17 2023, 2:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 17 2023, 2:43 AM
aprantl accepted this revision.Jan 20 2023, 11:18 AM
This revision is now accepted and ready to land.Jan 20 2023, 11:18 AM

HI,

I have no commit access to llvm git repo. Could someone please commit the patch for me?

Thanks,
Dongrui

This revision was landed with ongoing or failed builds.Jan 25 2023, 10:05 AM
This revision was automatically updated to reflect the committed changes.