summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
Commit message (Collapse)AuthorAgeFilesLines
* [profile] Add a mode to continuously sync counter updates to a fileVedant Kumar2019-10-311-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for continuously syncing profile counter updates to a file. The motivation for this is that programs do not always exit cleanly. On iOS, for example, programs are usually killed via a signal from the OS. Running atexit() handlers after catching a signal is unreliable, so some method for progressively writing out profile data is necessary. The approach taken here is to mmap() the `__llvm_prf_cnts` section onto a raw profile. To do this, the linker must page-align the counter and data sections, and the runtime must ensure that counters are mapped to a page-aligned offset within a raw profile. Continuous mode is (for the moment) incompatible with the online merging mode. This limitation is lifted in https://reviews.llvm.org/D69586. Continuous mode is also (for the moment) incompatible with value profiling, as I'm not sure whether there is interest in this and the implementation may be tricky. As I have not been able to test extensively on non-Darwin platforms, only Darwin support is included for the moment. However, continuous mode may "just work" without modification on Linux and some UNIX-likes. AIUI the default value for the GNU linker's `--section-alignment` flag is set to the page size on many systems. This appears to be true for LLD as well, as its `no_nmagic` option is on by default. Continuous mode will not "just work" on Fuchsia or Windows, as it's not possible to mmap() a section on these platforms. There is a proposal to add a layer of indirection to the profile instrumentation to support these platforms. rdar://54210980 Differential Revision: https://reviews.llvm.org/D68351
* [llvm-profdata] Reinstate ↵Vedant Kumar2019-10-151-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | tools/llvm-profdata/malformed-ptr-to-counter-array.test I removed this test to unblock the ARM bots while looking into failures (r374915), and am reinstating it now with a fix. I believe the problem was that counter ptr address I used, '\0\0\6\0\1\0\0\1', set the high bits of the pointer, not the low bits like I wanted. On x86_64 this superficially looks like it tests r370826, but it doesn't, as it would have been caught before r370826. However, on ARM (or, 32-bit hosts more generally), I suspect the high bits were cleared, and you get a 'valid' profile. I verified that setting the *low* bits of the pointer does trigger the new condition: -// Note: The CounterPtr here is off-by-one. This should trigger a malformed profile error. -RUN: printf '\0\0\6\0\1\0\0\1' >> %t.profraw +// Note: The CounterPtr here is off-by-one. +// +// Octal '\11' is 9 in decimal: this should push CounterOffset to 1. As there are two counters, +// the profile reader should error out. +RUN: printf '\11\0\6\0\1\0\0\0' >> %t.profraw This reverts commit c7cf5b3e4b918c9769fd760f28485b8d943ed968. llvm-svn: 374927
* [llvm-profdata] Remove tools/llvm-profdata/malformed-ptr-to-counter-array.testVedant Kumar2019-10-151-48/+0
| | | | | | | This test is still failing on the ARM bots and I need time to investigate. llvm-svn: 374915
* [llvm-profdata] Weaken "malformed-ptr-to-counter-array.test" to appease arm botsVedant Kumar2019-10-141-3/+1
| | | | | | | | | | | | | | There are a number arm bots failing after r374617 landed, and I'm not sure why. It looks a bit like the error message llvm-profdata is expected to print to stderr isn't flushed. Weaken the test in an attempt to appease the arm bots: if this doesn't work, that means that llvm-profdata is actually *not failing*, and that will be a clear indication that some logic error is actually happening. http://lab.llvm.org:8011/builders/clang-cmake-armv7-global-isel/builds/5604/ llvm-svn: 374792
* [llvm-profdata] Make "malformed-ptr-to-counter-array.test" textualVedant Kumar2019-10-121-2/+47
| | | | | | | | | As pointed out in https://reviews.llvm.org/D66979 post-commit, making this test textual would make it more maintainable. Differential Revision: https://reviews.llvm.org/D68718 llvm-svn: 374617
* [InstrProf] Tighten a check for malformed data records in raw profilesVedant Kumar2019-09-031-0/+5
The check needs to validate a counter offset before performing pointer arithmetic with the (potentially corrupt) offset. Found by UBSan's pointer overflow check. rdar://54843625 Differential Revision: https://reviews.llvm.org/D66979 llvm-svn: 370826
OpenPOWER on IntegriCloud