From 100319cdb4f7194707a885e456a0dbb2a2ffd02e Mon Sep 17 00:00:00 2001 From: esmeyi Date: Wed, 13 Jul 2022 03:39:08 -0400 Subject: [PATCH] [AIX] follow-up of D124654. Report an error when alias symbols are not emitted all. --- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 5 +++++ llvm/test/CodeGen/PowerPC/aix-alias-alignment-3.ll | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 llvm/test/CodeGen/PowerPC/aix-alias-alignment-3.ll diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 64ce270..94612a5 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -3357,6 +3357,11 @@ void AsmPrinter::emitGlobalConstant(const DataLayout &DL, const Constant *CV, // look like they are at the same location. OutStreamer->emitIntValue(0, 1); } + if (!AliasList) + return; + for (const auto &AliasPair : *AliasList) + report_fatal_error("Aliases with offset " + Twine(AliasPair.first) + + " were not emitted."); } void AsmPrinter::emitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) { diff --git a/llvm/test/CodeGen/PowerPC/aix-alias-alignment-3.ll b/llvm/test/CodeGen/PowerPC/aix-alias-alignment-3.ll new file mode 100644 index 0000000..7934638 --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/aix-alias-alignment-3.ll @@ -0,0 +1,8 @@ +;; TODO: The alias offset doesn't refer to any sub-element. +; RUN: not --crash llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \ +; RUN: -data-sections=false < %s 2>&1 | FileCheck --check-prefix=ERROR %s + +; ERROR: Aliases with offset 1 were not emitted. + +@ConstVector = global <2 x i64> +@var = alias i64, getelementptr inbounds (i8, ptr @ConstVector, i32 1) -- 2.7.4