mirror of
https://github.com/RPCS3/llvm.git
synced 2025-05-22 05:15:57 +00:00

Summary: This patch prevents importing from (and therefore exporting from) any module with a "llvm.used" local value. Local values need to be promoted and renamed when importing, and their presense on the llvm.used variable indicates that there are opaque uses that won't see the rename. One such example is a use in inline assembly. See also the discussion at: http://lists.llvm.org/pipermail/llvm-dev/2016-April/098047.html As part of this, move collectUsedGlobalVariables out of Transforms/Utils and into IR/Module so that it can be used more widely. There are several other places in LLVM that used copies of this code that can be cleaned up as a follow on NFC patch. Reviewers: joker.eph Subscribers: pcc, llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D18986 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266877 91177308-0d34-0410-b5e6-96231b3b80d8
12 lines
422 B
LLVM
12 lines
422 B
LLVM
@myvar = internal constant i8 1, align 1
|
|
@llvm.used = appending global [1 x i8*] [i8* @myvar], section "llvm.metadata"
|
|
|
|
define void @foo(i64* %v) #0 {
|
|
entry:
|
|
%v.addr = alloca i64*, align 8
|
|
store i64* %v, i64** %v.addr, align 8
|
|
%0 = load i64*, i64** %v.addr, align 8
|
|
call void asm sideeffect "movzbl myvar(%rip), %eax\0A\09movq %rax, $0\0A\09", "=*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i64* %0) #1
|
|
ret void
|
|
}
|