steven_wu added a comment.

In D141625#4052869 <https://reviews.llvm.org/D141625#4052869>, @rsmith wrote:

> In D141625#4052820 <https://reviews.llvm.org/D141625#4052820>, @dblaikie 
> wrote:
>
>> Yeah, might be nice to document where the instability comes from - if it 
>> comes from a DenseMap or similar, then a test that fails either in forward 
>> or reverse iteration mode would be nice to have.
>
> `Scope::decls` is iterating over a `SmallPtrSet`. This might be a little 
> annoying to create a test for, because it'll only be unstable if we have two 
> decls in the same prototype scope that get allocated into different slabs by 
> the bump ptr allocator, but maybe something like:
>
>   void f(struct A *p, int arr[1 + 0 + 0 + 0 + ... + 0], struct B *q);
>
> ... would be enough (with sufficient subexpressions to fill a whole slab). 
> Then we can build a .pch for that twice and check that it comes out identical.

Yeah, it is really hard to trigger a failure. Even the second decl gets onto a 
different slab, the second slab will most likely come after the previous one 
when there isn't much memory pressure.

I can write a test like that but it is really hard to trigger without an 
enormous module (building Darwin module from macOS SDK can reproduce very 
reliable).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141625

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to