[Chapel Merge] Remove a compiler nondeterminism from a use of Sma

Branch: refs/heads/main
Revision: da93197
Author: mppf
Link: Unavailable
Log Message:

Merge pull request #20251 from mppf/avoid-19561-nondeterminism

Remove a compiler nondeterminism from a use of SmallPtrSet

PR #19561 changed dead code elimination in a way that introduces
nondeterminism. It changed a set to a SmallPtrSet but that set is
traversed and added to a work queue. The result is, with the SmallPtrSet,
the order of elements in the work queue depends on what addresses the
allocator got, which can vary run-to-run with ASLR.

When using a std::set, this problem is avoided because the comparison
routine for such a set compares the integer id field instead of the
pointer value (since #6876).

We noticed this issue because there were nightly failures with these
tests in gasnet-asan testing:

distributions/bharshbarg/stencil/rankChange.chpl
distributions/robust/arithmetic/collapsing/test_domain_rank_change1.chpl
distributions/robust/arithmetic/collapsing/test_domain_rank_change_OOB.chpl

This PR reverts just the change in PR #19561 to dead code elimination to
remove that nondeterminism.

Reviewed by @benharsh - thanks!