This probably fixes PR35277, though there may be other sources of
nondeterminism (this was the only case of iterating over a DenseMap).
It's difficult to provide a test case for this, because it shows up only
on systems with ASLR enabled.
Differential D50559
[gnu-objc] Make selector order deterministic. theraven on Aug 10 2018, 6:40 AM. Authored by
Details This probably fixes PR35277, though there may be other sources of It's difficult to provide a test case for this, because it shows up only
Diff Detail
Event TimelineComment Actions Does the error show up if you build llvm with -DLLVM_REVERSE_ITERATION:ON? LLVM_REVERSE_ITERATION:BOOL If enabled, all supported unordered llvm containers would be iterated in reverse order. This is useful for uncovering non-determinism caused by iteration of unordered containers. Comment Actions got a build failure with this patch added onto 6.0.1
Comment Actions You can't test that there's no non-determinism, but you can certainly test that we emit selectors in sorted order as opposed to the order in which they're used. I imagine a function with a bunch of @selector expressions should be good enough for that.
Comment Actions I got it compiled with std::sort on top of 6.0.1 and found that it indeed removes the indeterminism: When I compiled libobjc2-1.8.1/arc.m 25 times, I got the same md5sum every time - and the same result with and without ASLR. Comment Actions Thanks. I appreciate the fact that you spelled it all out in the test, too. LGTM.
|
compilation failed here:
../tools/clang/lib/CodeGen/CGObjCGNU.cpp:2444:11: error: 'sort' is not a member of 'llvm'
it suggested std::sort