[DebugInfo] Prevent non-determinism when updating DIArgList users of a value
authorStephen Tozer <Stephen.Tozer@Sony.com>
Thu, 17 Jun 2021 12:58:34 +0000 (13:58 +0100)
committerStephen Tozer <Stephen.Tozer@Sony.com>
Thu, 17 Jun 2021 14:09:27 +0000 (15:09 +0100)
commitfa1de88f81e9c6db5255ca7c4d0fd25606c5a054
tree0351db685b0bc0d3a62bf0cdb12d00468c5a695c
parent7cddf56d608f07b8e49f7e2eeb4a20082611adb6
[DebugInfo] Prevent non-determinism when updating DIArgList users of a value

This patch fixes an issue where builds of programs with multiple dbg.values
with DIArgList locations could have non-deterministic output. This issue
was caused by ReplaceableMetadataImpl::getAllArgListUsers, which
returned DIArgList pointers in a random order; the output of this
function would later be used to insert dbg.values, causing the order of
insertion to be non-deterministic. This patch changes getAllArgListUsers
to return pointers in a fixed order.

Differential Revision: https://reviews.llvm.org/D104105
llvm/lib/IR/Metadata.cpp