mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
7ddbe79e6f
Currently, AsmWriter will stick uselistorder directives for global values inside individual functions. This doesn't make a lot of sense, and interacts badly with D104950, as use list order adjustments will be performed while still working on a forward reference. This patch instead always prints uselistorder directives for globals at the module level. This isn't really compatible with the previously used implementation approach. Rather than walking through all values again, use the OrderMap (after stabilizing its order) to go through all values and compute the use list shuffles for them. Classify them per-function, or nullptr for globals. Even independently of D104950, this seems to fix a few verify-uselistorder failures. Conveniently, there is even a pre-existing failing test that this fixes. Differential Revision: https://reviews.llvm.org/D104976
28 lines
527 B
LLVM
28 lines
527 B
LLVM
; RUN: opt -S -preserve-ll-uselistorder < %s | FileCheck %s
|
|
; RUN: verify-uselistorder %s
|
|
|
|
; CHECK: @g = external global i32
|
|
; CHECK: define void @func1() {
|
|
; CHECK-NOT: uselistorder
|
|
; CHECK: }
|
|
; CHECK: define void @func2() {
|
|
; CHECK-NOT: uselistorder
|
|
; CHECK: }
|
|
; CHECK: uselistorder i32* @g, { 3, 2, 1, 0 }
|
|
|
|
@g = external global i32
|
|
|
|
define void @func1() {
|
|
load i32, i32* @g
|
|
load i32, i32* @g
|
|
ret void
|
|
}
|
|
|
|
define void @func2() {
|
|
load i32, i32* @g
|
|
load i32, i32* @g
|
|
ret void
|
|
}
|
|
|
|
uselistorder i32* @g, { 3, 2, 1, 0 }
|