IR: Fix use-list-order round-tripping for call and invoke
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 23 Jun 2021 18:25:04 +0000 (11:25 -0700)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 23 Jun 2021 19:04:19 +0000 (12:04 -0700)
commit3cf415c6c367ced43175ebd1dc4bd9582c7f5376
tree5a0f854a17180da033a575b24cfd03178de84267
parent0eac975b51cca5b54a1f516d05a233c215375eda
IR: Fix use-list-order round-tripping for call and invoke

Fix the use-list-order for call and invoke instructions by setting the
operands in order of their index. This matches the use-list-order
prediction. Note that the verifier precludes sharing operands in callbr
(so there was no bug to fix), but that code was updated for consistency.

Bug was found during review of https://reviews.llvm.org/D104740.

Differential Revision: https://reviews.llvm.org/D104805
llvm/lib/IR/Instructions.cpp
llvm/test/Assembler/call-arg-is-callee.ll [new file with mode: 0644]