]> granicus.if.org Git - llvm/commit
Do not call replaceAllUsesWith to upgrade calls to ARC runtime functions
authorAkira Hatanaka <ahatanaka@apple.com>
Tue, 13 Aug 2019 01:23:06 +0000 (01:23 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Tue, 13 Aug 2019 01:23:06 +0000 (01:23 +0000)
commitc5576e0d9d0df87973c248b35d596d06dd4ce0c2
tree3031993087de60a5acd2cbdc7e3f932b9285a69c
parentae4f6e8d53e0ccf6458dfb4959ff2af8005cc93d
Do not call replaceAllUsesWith to upgrade calls to ARC runtime functions
to intrinsic calls

This fixes a bug in r368311.

It turns out that the ARC runtime functions in the IR can have pointer
parameter types that are not i8* or i8**. Instead of RAUWing normal
functions with intrinsics, manually bitcast the arguments before passing
them to the intrinsic functions and bitcast the return value back to the
type of the original call instruction.

This recommits r368634, which was reverted in r368637. The loop in the
patch was iterating over uses of a function and deleting function calls
inside it, which caused bots to crash.

rdar://problem/54125406

Differential Revision: https://reviews.llvm.org/D66047

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368646 91177308-0d34-0410-b5e6-96231b3b80d8
lib/IR/AutoUpgrade.cpp
test/Bitcode/upgrade-arc-runtime-calls.bc
test/Bitcode/upgrade-arc-runtime-calls.ll
test/Bitcode/upgrade-mrr-runtime-calls.bc