[Transforms/ObjCARC] Fix non-deterministic output of `ObjCARCOptPass`
authorArgyrios Kyrtzidis <kyrtzidis@apple.com>
Thu, 6 Oct 2022 17:02:19 +0000 (10:02 -0700)
committerArgyrios Kyrtzidis <kyrtzidis@apple.com>
Fri, 14 Oct 2022 19:26:58 +0000 (12:26 -0700)
commitd877e3fe71676b0ff10410d80456b35cdd5bf796
tree3ff611f2bd0a35fb89232b209bf46505571d7213
parent34bbe6548dd9a932aecbcf417714ba103e0e2ddf
[Transforms/ObjCARC] Fix non-deterministic output of `ObjCARCOptPass`

`ProvenanceAnalysis::related()` was assuming that the order of parameters for `relatedCheck()` was not affecting
the result but this was not the case when both parameters were `PHINode`s.
Due to this assumption `ProvenanceAnalysis::related()` was ordering the parameters based on pointer value which resulted in
non-deterministic behavior.

To address this change `relatedPHI()` so that it gives the same result independent of the parameter order.

rdar://100325456

Differential Revision: https://reviews.llvm.org/D135376
llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.cpp
llvm/test/Transforms/ObjCARC/related-check.ll [new file with mode: 0644]