llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-backend-x86 Author: llvmbot <details> <summary>Changes</summary> Backport fed20e0e68323be32cb0fe8af679b8cb34e72112 Requested by: @<!-- -->nikic --- Full diff: https://github.com/llvm/llvm-project/pull/238262.diff 2 Files Affected: - (modified) llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (+2) - (added) llvm/test/CodeGen/X86/null-pointer-vector-object.ll (+20) ``````````diff diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index f3ac25f25fcc14..1a9c3e7114fdb6 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -4532,6 +4532,8 @@ static void emitGlobalConstantImpl(const DataLayout &DL, const Constant *CV, } if (isa<ConstantPointerNull>(CV)) { + if (isa<VectorType>(CV->getType())) + return emitGlobalConstantVector(DL, CV, AP, AliasList); AP.OutStreamer->emitIntValue(0, Size); return; } diff --git a/llvm/test/CodeGen/X86/null-pointer-vector-object.ll b/llvm/test/CodeGen/X86/null-pointer-vector-object.ll new file mode 100644 index 00000000000000..3e861cdc31b501 --- /dev/null +++ b/llvm/test/CodeGen/X86/null-pointer-vector-object.ll @@ -0,0 +1,20 @@ +; RUN: llc -mtriple=x86_64-unknown-linux-gnu -data-sections -filetype=obj %s -o %t.64 +; RUN: llvm-readobj --symbols %t.64 | FileCheck %s --check-prefixes=CHECK,ELF64 +; RUN: llc -mtriple=i686-unknown-linux-gnu -data-sections -filetype=obj %s -o %t.32 +; RUN: llvm-readobj --symbols %t.32 | FileCheck %s --check-prefixes=CHECK,ELF32 +; RUN: llc -mtriple=x86_64-pc-windows-msvc -data-sections -filetype=obj %s -o /dev/null + +; Both spellings of a null pointer vector use ConstantPointerNull. Its size +; can exceed the eight-byte limit of MCStreamer::emitIntValue. Check successful +; object emission for ELF and COFF, and symbol sizes and BSS placement for ELF. +@v2 = global <2 x ptr> zeroinitializer +@v4 = global <4 x ptr> splat (ptr null) + +; CHECK: Name: v2 +; ELF64: Size: 16 +; ELF32: Size: 8 +; CHECK: Section: .bss.v2 +; CHECK: Name: v4 +; ELF64: Size: 32 +; ELF32: Size: 16 +; CHECK: Section: .bss.v4 `````````` </details> https://github.com/llvm/llvm-project/pull/238262 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
