From e043c0c68ceb5bc668e9a5c0fa6f572973ea078b Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Thu, 17 Mar 2016 23:36:31 +0000 Subject: [PATCH] [LTO] Test lto passes are actually working. This should have been part of r263761. llvm-svn: 263763 --- lld/test/ELF/lto/ctors.ll | 1 + lld/test/ELF/lto/ltopasses-basic.ll | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 lld/test/ELF/lto/ltopasses-basic.ll diff --git a/lld/test/ELF/lto/ctors.ll b/lld/test/ELF/lto/ctors.ll index 629e503..aaf9a13 100644 --- a/lld/test/ELF/lto/ctors.ll +++ b/lld/test/ELF/lto/ctors.ll @@ -8,6 +8,7 @@ target triple = "x86_64-unknown-linux-gnu" @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @ctor, i8* null }] define void @ctor() { + call void asm "nop", ""() ret void } diff --git a/lld/test/ELF/lto/ltopasses-basic.ll b/lld/test/ELF/lto/ltopasses-basic.ll new file mode 100644 index 0000000..ce56539 --- /dev/null +++ b/lld/test/ELF/lto/ltopasses-basic.ll @@ -0,0 +1,16 @@ +; REQUIRES: x86 +; RUN: rm -f %t %t.lto.bc %t.lto.opt.bc %t.lto.o +; RUN: llvm-as %s -o %t.o +; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -save-temps -shared +; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @ctor, i8* null }] +define void @ctor() { + ret void +} + +; `@ctor` doesn't do anything and so the optimizer should kill it, leaving no ctors +; CHECK: @llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer -- 2.7.4