[PATCH] D121556: [randstruct] Add randomize structure layout support

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 11 19:35:14 PDT 2022


MaskRay added a comment.

In D121556#3444260 <https://reviews.llvm.org/D121556#3444260>, @void wrote:

> In D121556#3444221 <https://reviews.llvm.org/D121556#3444221>, @MaskRay wrote:
>
>> In D121556#3444131 <https://reviews.llvm.org/D121556#3444131>, @void wrote:
>>
>>> In D121556#3444021 <https://reviews.llvm.org/D121556#3444021>, @MaskRay wrote:
>>>
>>>> 7aa8c38a9e190aea14116028c38b1d9f54cbb0b3 <https://reviews.llvm.org/rG7aa8c38a9e190aea14116028c38b1d9f54cbb0b3> still uses `std::shuffle`, not incorporating the `llvm::shuffle` fixes I did.
>>>
>>> You said it was still failing after the std::shuffle to llvm::shuffle change.
>>
>> By saying it still failed, I meant there were other Windows vs non-Windows differences, not that std::shuffle=>llvm::shuffle was an unintended change.
>
> So does it work or not? If I change it to `llvm::shuffle`, will the tests fail or will they pass regardless of the platform?

If you change `std::shuffle` to `llvm::shuffle` and  add back tests like `EXPECT_EQ(Expected, getFieldNamesFromRecord(RD));`, the test will likely fail on Windows.
I recall that @aaron.ballman uses Windows and may help you find the differences.
I tend to agree with your `I think it's just a case where Windows' algorithm for std::mt19937 is subtly different than the one for Linux.`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121556/new/

https://reviews.llvm.org/D121556



More information about the cfe-commits mailing list