Simplify printAlias.
authorJay Foad <jay.foad@gmail.com>
Mon, 1 Aug 2011 12:29:14 +0000 (12:29 +0000)
committerJay Foad <jay.foad@gmail.com>
Mon, 1 Aug 2011 12:29:14 +0000 (12:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136611 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/AsmWriter.cpp

index 825a7c1b66f009f69dc53f723cdd7321f8e2c78a..de993eec69f94e3a13e4e8d6afc3f8def2fbbff0 100644 (file)
@@ -1397,27 +1397,8 @@ void AssemblyWriter::printAlias(const GlobalAlias *GA) {
   if (Aliasee == 0) {
     TypePrinter.print(GA->getType(), Out);
     Out << " <<NULL ALIASEE>>";
-  } else if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Aliasee)) {
-    TypePrinter.print(GV->getType(), Out);
-    Out << ' ';
-    PrintLLVMName(Out, GV);
-  } else if (const Function *F = dyn_cast<Function>(Aliasee)) {
-    TypePrinter.print(F->getFunctionType(), Out);
-    Out << "* ";
-
-    WriteAsOperandInternal(Out, F, &TypePrinter, &Machine, F->getParent());
-  } else if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(Aliasee)) {
-    TypePrinter.print(GA->getType(), Out);
-    Out << ' ';
-    PrintLLVMName(Out, GA);
-  } else {
-    const ConstantExpr *CE = cast<ConstantExpr>(Aliasee);
-    // The only valid GEP is an all zero GEP.
-    assert((CE->getOpcode() == Instruction::BitCast ||
-            CE->getOpcode() == Instruction::GetElementPtr) &&
-           "Unsupported aliasee");
-    writeOperand(CE, false);
-  }
+  } else
+    writeOperand(Aliasee, !isa<ConstantExpr>(Aliasee));
 
   printInfoComment(*GA);
   Out << '\n';