[GlobalOpt] Don't replace the aliasee if it has other references.
authorDianQK <dianqk@dianqk.net>
Thu, 27 Apr 2023 00:10:15 +0000 (08:10 +0800)
committerDianQK <dianqk@dianqk.net>
Thu, 27 Apr 2023 01:53:47 +0000 (09:53 +0800)
commit533b7c1f6c696817df332cc7c9acbe3b454eadf2
treeb2ef8330029141f275bd287d24f972b69b9ecea2
parent4c83674679365dd990fef5f834a07ad32798e7f2
[GlobalOpt] Don't replace the aliasee if it has other references.

As long as aliasee has `@llvm.used` or `@llvm.compiler.used` references, we cannot do the related replace or delete operations. Even if it is a Local Linkage, we cannot infer if there is no other use for it, such as asm or other future added cases.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D145293
llvm/lib/Transforms/IPO/GlobalOpt.cpp
llvm/test/Transforms/GlobalOpt/X86/alias-used-with-asm.ll [new file with mode: 0644]
llvm/test/Transforms/GlobalOpt/alias-used-address-space.ll
llvm/test/Transforms/GlobalOpt/alias-used.ll
polly/test/Support/dumpfunction.ll