This is an archive of the discontinued LLVM Phabricator instance.

[llvm-profdata] Remove unnecessary file size check
ClosedPublic

Authored by huangjd on Dec 28 2022, 1:26 PM.

Details

Summary

Unsure why profile reader checks profile size to be less than 4 GB. This breaks builds using a very large profile.
The limit is not seen anywhere else, so I am not sure why is it there in the first place.

Diff Detail

Event Timeline

huangjd created this revision.Dec 28 2022, 1:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 28 2022, 1:26 PM
huangjd requested review of this revision.Dec 28 2022, 1:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 28 2022, 1:26 PM

Some filesystems have a 4GB limit on file size (notably FAT32). Given that llvm-profdata as a tool is built for multiple platforms, I don't think we should remove this check.

Some filesystems have a 4GB limit on file size (notably FAT32). Given that llvm-profdata as a tool is built for multiple platforms, I don't think we should remove this check.

This check is in the Reader, not Writer. The entire file is already read at this point so if there's any IO error it would happen at line 1835, which is already checked.

snehasish added a comment.EditedDec 28 2022, 3:02 PM

Some filesystems have a 4GB limit on file size (notably FAT32). Given that llvm-profdata as a tool is built for multiple platforms, I don't think we should remove this check.

This check is in the Reader, not Writer. The entire file is already read at this point so if there's any IO error it would happen at line 1835, which is already checked.

I see, looking at the commit which added the code doesn't seem to give any more clues apart from it being a sanity check. So then it might be ok to remove?
https://github.com/llvm/llvm-project/commit/c572e92c763f44bddfa30bc43e9027547b72dbfa

Not sure if @dnovillo is active.

arsenm added a subscriber: arsenm.Dec 28 2022, 3:24 PM

Some filesystems have a 4GB limit on file size (notably FAT32). Given that llvm-profdata as a tool is built for multiple platforms, I don't think we should remove this check.

Let the file system check that, don't force artificial restrictions in random places

The check also looks suspicious by casting size_t to uint64_t. If size_t is 64 bit the cast has no effect, and if size_t is 32 bit then the condition is always false, so I don't understand what's the purpose of this check

davidxl accepted this revision.Jan 3 2023, 10:44 AM

The check looks unnecessary or misplaced.

This revision is now accepted and ready to land.Jan 3 2023, 10:44 AM
This revision was automatically updated to reflect the committed changes.