This is an archive of the discontinued LLVM Phabricator instance.

Handle whitespace in symbol list
ClosedPublic

Authored by beanz on Jan 18 2022, 9:15 AM.

Details

Summary

Trimming whitespace or carriage returns from symbols allows this code
to work on Windows and makes it match other places symbol lists are
handled.

No test provided because
test/Transforms/SampleProfile/uncompressed-profile-symbol-list.ll fails
on Windows if the git checkout uses CRLF line endings.

Diff Detail

Event Timeline

beanz requested review of this revision.Jan 18 2022, 9:15 AM
beanz created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2022, 9:15 AM

No test provided because test/Transforms/SampleProfile/uncompressed-profile-symbol-list.ll fails on Windows if the git checkout uses CRLF line endings.

You may just call SymbolStr.trim() (see `lld/Common/Args.cpp) and add a test with whitespace.

beanz updated this revision to Diff 400895.Jan 18 2022, 9:59 AM

Upating based on feedback from @MaskRay!

MaskRay accepted this revision.Jan 18 2022, 10:02 AM

LGTM.

llvm/test/Transforms/SampleProfile/Inputs/profile-symbol-list.text
10 ↗(On Diff #400895)

You may add leading spaces to another line to make the intention clearer.

llvm/tools/llvm-profdata/llvm-profdata.cpp
665

The variable is only called once. Just inline SymbolStr.trim() into the caller.

This revision is now accepted and ready to land.Jan 18 2022, 10:02 AM
beanz updated this revision to Diff 400903.Jan 18 2022, 10:27 AM

More updates based on @MaskRay's feedback

This revision was landed with ongoing or failed builds.Jan 18 2022, 12:35 PM
This revision was automatically updated to reflect the committed changes.