[PATCH] D64951: CodeGen: Allow !associated metadata to point to aliases.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 14:40:06 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL366502: CodeGen: Allow !associated metadata to point to aliases. (authored by pcc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D64951?vs=210677&id=210681#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64951/new/

https://reviews.llvm.org/D64951

Files:
  llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/trunk/test/CodeGen/X86/elf-associated.ll


Index: llvm/trunk/test/CodeGen/X86/elf-associated.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/elf-associated.ll
+++ llvm/trunk/test/CodeGen/X86/elf-associated.ll
@@ -33,7 +33,7 @@
 ; CHECK-DAG: .section	bbb,"awo", at progbits,h,unique,2
 ; CHECK-DAG: .section	.data.k,"awo", at progbits,h
 
-; Non-GlobalObject metadata.
+; Non-GlobalValue metadata.
 @l = global i32 1, section "ccc", !associated !5
 !5 = !{i32* null}
 ; CHECK-DAG: .section	ccc,"aw", at progbits
@@ -42,3 +42,9 @@
 @m = global i32 1, section "ddd", !associated !6
 !6 = distinct !{null}
 ; CHECK-DAG: .section	ddd,"aw", at progbits
+
+; Aliases are OK.
+ at n = alias i32, i32* inttoptr (i64 add (i64 ptrtoint (i32* @a to i64), i64 1297036692682702848) to i32*)
+ at o = global i32 1, section "eee", !associated !7
+!7 = !{i32* @n}
+; CHECK-DAG: .section	eee,"awo", at progbits,n,unique,3
Index: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -524,8 +524,8 @@
   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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64951.210681.patch
Type: text/x-patch
Size: 1592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190718/0fd53dfe/attachment.bin>


More information about the llvm-commits mailing list