mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-05 03:36:43 +00:00
CodeGen: Allow !associated metadata to point to aliases.
This is a small extension of !associated, mostly useful for the implementation convenience of instrumentation passes that RAUW globals with aliases, such as LowerTypeTests. Differential Revision: https://reviews.llvm.org/D64951 llvm-svn: 366502
This commit is contained in:
parent
8fbcf61f43
commit
658ff0579c
@ -524,8 +524,8 @@ static const MCSymbolELF *getAssociatedSymbol(const GlobalObject *GO,
|
||||
if (!VM)
|
||||
report_fatal_error("MD_associated operand is not ValueAsMetadata");
|
||||
|
||||
GlobalObject *OtherGO = dyn_cast<GlobalObject>(VM->getValue());
|
||||
return OtherGO ? dyn_cast<MCSymbolELF>(TM.getSymbol(OtherGO)) : nullptr;
|
||||
auto *OtherGV = dyn_cast<GlobalValue>(VM->getValue());
|
||||
return OtherGV ? dyn_cast<MCSymbolELF>(TM.getSymbol(OtherGV)) : nullptr;
|
||||
}
|
||||
|
||||
static unsigned getEntrySizeForKind(SectionKind Kind) {
|
||||
|
@ -33,7 +33,7 @@
|
||||
; CHECK-DAG: .section bbb,"awo",@progbits,h,unique,2
|
||||
; CHECK-DAG: .section .data.k,"awo",@progbits,h
|
||||
|
||||
; Non-GlobalObject metadata.
|
||||
; Non-GlobalValue metadata.
|
||||
@l = global i32 1, section "ccc", !associated !5
|
||||
!5 = !{i32* null}
|
||||
; CHECK-DAG: .section ccc,"aw",@progbits
|
||||
@ -42,3 +42,9 @@
|
||||
@m = global i32 1, section "ddd", !associated !6
|
||||
!6 = distinct !{null}
|
||||
; CHECK-DAG: .section ddd,"aw",@progbits
|
||||
|
||||
; Aliases are OK.
|
||||
@n = alias i32, i32* inttoptr (i64 add (i64 ptrtoint (i32* @a to i64), i64 1297036692682702848) to i32*)
|
||||
@o = global i32 1, section "eee", !associated !7
|
||||
!7 = !{i32* @n}
|
||||
; CHECK-DAG: .section eee,"awo",@progbits,n,unique,3
|
||||
|
Loading…
x
Reference in New Issue
Block a user