llvm-project
6d7053ab - [InstrProf] Init -memprof-random-hotness-seed to constant default value (#217083)

Commit
18 days ago
[InstrProf] Init -memprof-random-hotness-seed to constant default value (#217083) There are two places where `llvm-profdata` uses randomness. 1. To generate random hotness values in MemProf, created in https://github.com/llvm/llvm-project/pull/113998 2. To sample a set of traces here https://github.com/llvm/llvm-project/blob/bc2e50bf7baf1c52370f8d8cdfee4bba2180d27a/llvm/lib/ProfileData/InstrProfWriter.cpp#L383-L391 Prior to this PR, these used two different implementations. Apparently the implementation of `std::rand()` depends on the platform, causing the test in https://github.com/llvm/llvm-project/pull/216878 to fail on windows. Switching to `std::mt19937` should solve this problem, which is already used to sample traces. While I'm here, also create the `-random-seed` flag to alias `-memprof-random-hotness-seed`, which is now used by both places in `llvm-profdata`. Deprecate `-memprof-random-hotness-seed` in favor of the alias `-random-seed`. This does change some details of the MemProf use case. 1. We no longer print `random hotness seed =` to stderr 2. `-random-seed=0` now uses the default seed rather than `std::time()`. This allows these commands to be deterministic by default.
Author
Parents
Loading