From e5551ed9cec1ae777c4e4b8852a1d7842c2e1c3d Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 26 Oct 2012 18:47:48 +0000 Subject: Change the internalize pass to internalize all symbols when given an empty list of externals. This makes sense since a shared library with no symbols can still be useful if it has static constructors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166795 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Other/link-opts.ll | 13 +++++++++++++ test/Transforms/Internalize/2008-05-09-AllButMain.ll | 9 +++++---- .../Transforms/Internalize/2009-01-05-InternalizeAliases.ll | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 test/Other/link-opts.ll (limited to 'test') diff --git a/test/Other/link-opts.ll b/test/Other/link-opts.ll new file mode 100644 index 0000000000..8e58ac8a56 --- /dev/null +++ b/test/Other/link-opts.ll @@ -0,0 +1,13 @@ +;RUN: opt -S -std-link-opts < %s | FileCheck %s +; Simple test to check that -std-link-opts keeps only the main function. + +; CHECK-NOT: define +; CHECK: define void @main +; CHECK-NOT: define +define void @main() { + ret void +} + +define void @foo() { + ret void +} diff --git a/test/Transforms/Internalize/2008-05-09-AllButMain.ll b/test/Transforms/Internalize/2008-05-09-AllButMain.ll index 1101f997d7..c07abb0c63 100644 --- a/test/Transforms/Internalize/2008-05-09-AllButMain.ll +++ b/test/Transforms/Internalize/2008-05-09-AllButMain.ll @@ -1,10 +1,11 @@ -; No arguments means internalize all but main +; No arguments means internalize everything ; RUN: opt < %s -internalize -S | FileCheck --check-prefix=NOARGS %s ; Internalize all but foo and j ; RUN: opt < %s -internalize -internalize-public-api-list foo -internalize-public-api-list j -S | FileCheck --check-prefix=LIST %s -; Non existent files should be treated as if they were empty (so internalize all but main) +; Non existent files should be treated as if they were empty (so internalize +; everything) ; RUN: opt < %s -internalize -internalize-public-api-file /nonexistent/file 2> /dev/null -S | FileCheck --check-prefix=EMPTYFILE %s ; RUN: opt < %s -S -internalize -internalize-public-api-list bar -internalize-public-api-list foo -internalize-public-api-file /nonexistent/file 2> /dev/null | FileCheck --check-prefix=LIST2 %s @@ -26,9 +27,9 @@ ; MERGE: @j = global @j = global i32 0 -; NOARGS: define void @main +; NOARGS: define internal void @main ; LIST: define internal void @main -; EMPTYFILE: define void @main +; EMPTYFILE: define internal void @main ; LIST2: define internal void @main ; MERGE: define internal void @main define void @main() { diff --git a/test/Transforms/Internalize/2009-01-05-InternalizeAliases.ll b/test/Transforms/Internalize/2009-01-05-InternalizeAliases.ll index 7b18a04e11..47cf3f0373 100644 --- a/test/Transforms/Internalize/2009-01-05-InternalizeAliases.ll +++ b/test/Transforms/Internalize/2009-01-05-InternalizeAliases.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -internalize -S | grep internal | count 3 +; RUN: opt < %s -internalize -internalize-public-api-list main -S | grep internal | count 3 @A = global i32 0 @B = alias i32* @A -- cgit v1.2.3-18-g5258