<div dir="ltr">Does this need a LangRef update?<div><br></div><div>-- Sean Silva</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 17, 2015 at 10:53 AM, Rafael Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Wed Jun 17 12:53:31 2015<br>
New Revision: 239921<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D239921-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hX4QmpPOU6VXsjIbjnCcN8oYPAgX42AZkL3iPLgIFYU&s=wkM7CYCeaa8qYLOR7AK6_ZkTRDjZXCKX3AWq5lNgvtE&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=239921&view=rev</a><br>
Log:<br>
Allow aliases to be unnamed.<br>
<br>
If globals can be unnamed, there is no reason for aliases to be different.<br>
<br>
The restriction was there since the original implementation in r36435. I<br>
can only guess it was there because of the old bison parser for the old<br>
alias syntax.<br>
<br>
Added:<br>
llvm/trunk/test/Assembler/unnamed-alias.ll<br>
Modified:<br>
llvm/trunk/lib/AsmParser/LLParser.cpp<br>
llvm/trunk/lib/IR/AsmWriter.cpp<br>
llvm/trunk/lib/IR/Verifier.cpp<br>
<br>
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_AsmParser_LLParser.cpp-3Frev-3D239921-26r1-3D239920-26r2-3D239921-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hX4QmpPOU6VXsjIbjnCcN8oYPAgX42AZkL3iPLgIFYU&s=uI458GAys96dt41b3xutSbFL3kYQgREYRjNFIQ19oR0&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=239921&r1=239920&r2=239921&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)<br>
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Jun 17 12:53:31 2015<br>
@@ -670,6 +670,9 @@ bool LLParser::ParseAlias(const std::str<br>
GA->setDLLStorageClass((GlobalValue::DLLStorageClassTypes)DLLStorageClass);<br>
GA->setUnnamedAddr(UnnamedAddr);<br>
<br>
+ if (Name.empty())<br>
+ NumberedVals.push_back(GA.get());<br>
+<br>
// See if this value already exists in the symbol table. If so, it is either<br>
// a redefinition or a definition of a forward reference.<br>
if (GlobalValue *Val = M->getNamedValue(Name)) {<br>
<br>
Modified: llvm/trunk/lib/IR/AsmWriter.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_IR_AsmWriter.cpp-3Frev-3D239921-26r1-3D239920-26r2-3D239921-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hX4QmpPOU6VXsjIbjnCcN8oYPAgX42AZkL3iPLgIFYU&s=WBTGIzQ_BTS2FE82sY8_heu1rm8ADiMfVNHtV6hPys0&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AsmWriter.cpp?rev=239921&r1=239920&r2=239921&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/IR/AsmWriter.cpp (original)<br>
+++ llvm/trunk/lib/IR/AsmWriter.cpp Wed Jun 17 12:53:31 2015<br>
@@ -730,6 +730,11 @@ void SlotTracker::processModule() {<br>
CreateModuleSlot(&Var);<br>
}<br>
<br>
+ for (const GlobalAlias &A : TheModule->aliases()) {<br>
+ if (!A.hasName())<br>
+ CreateModuleSlot(&A);<br>
+ }<br>
+<br>
// Add metadata used by named metadata.<br>
for (const NamedMDNode &NMD : TheModule->named_metadata()) {<br>
for (unsigned i = 0, e = NMD.getNumOperands(); i != e; ++i)<br>
@@ -2356,13 +2361,9 @@ void AssemblyWriter::printAlias(const Gl<br>
if (GA->isMaterializable())<br>
Out << "; Materializable\n";<br>
<br>
- // Don't crash when dumping partially built GA<br>
- if (!GA->hasName())<br>
- Out << "<<nameless>> = ";<br>
- else {<br>
- PrintLLVMName(Out, GA);<br>
- Out << " = ";<br>
- }<br>
+ WriteAsOperandInternal(Out, GA, &TypePrinter, &Machine, GA->getParent());<br>
+ Out << " = ";<br>
+<br>
PrintLinkage(GA->getLinkage(), Out);<br>
PrintVisibility(GA->getVisibility(), Out);<br>
PrintDLLStorageClass(GA->getDLLStorageClass(), Out);<br>
<br>
Modified: llvm/trunk/lib/IR/Verifier.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_IR_Verifier.cpp-3Frev-3D239921-26r1-3D239920-26r2-3D239921-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hX4QmpPOU6VXsjIbjnCcN8oYPAgX42AZkL3iPLgIFYU&s=CB4aa3jgeRuG-BTFcLm7u-jHQvH8XLZqdC1h9Lq4fNQ&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=239921&r1=239920&r2=239921&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/IR/Verifier.cpp (original)<br>
+++ llvm/trunk/lib/IR/Verifier.cpp Wed Jun 17 12:53:31 2015<br>
@@ -584,7 +584,6 @@ void Verifier::visitAliaseeSubExpr(Small<br>
}<br>
<br>
void Verifier::visitGlobalAlias(const GlobalAlias &GA) {<br>
- Assert(!GA.getName().empty(), "Alias name cannot be empty!", &GA);<br>
Assert(GlobalAlias::isValidLinkage(GA.getLinkage()),<br>
"Alias should have private, internal, linkonce, weak, linkonce_odr, "<br>
"weak_odr, or external linkage!",<br>
<br>
Added: llvm/trunk/test/Assembler/unnamed-alias.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_Assembler_unnamed-2Dalias.ll-3Frev-3D239921-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=hX4QmpPOU6VXsjIbjnCcN8oYPAgX42AZkL3iPLgIFYU&s=FQc5XnAgKQWry49gH3lAi1dUWB-EdmXNO7panKmN0Wc&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/unnamed-alias.ll?rev=239921&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/Assembler/unnamed-alias.ll (added)<br>
+++ llvm/trunk/test/Assembler/unnamed-alias.ll Wed Jun 17 12:53:31 2015<br>
@@ -0,0 +1,11 @@<br>
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s<br>
+<br>
+@0 = private constant i32 0<br>
+; CHECK: @0 = private constant i32 0<br>
+@1 = private constant i32 1<br>
+; CHECK: @1 = private constant i32 1<br>
+<br>
+@2 = private alias i32* @0<br>
+; CHECK: @2 = private alias i32* @0<br>
+@3 = private alias i32* @1<br>
+; CHECK: @3 = private alias i32* @1<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>