[lld] 6ef37b6 - [lld/mac] Add test for --lto-O

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 19 13:45:40 PDT 2021


Author: Leonard Grey
Date: 2021-07-19T16:45:33-04:00
New Revision: 6ef37b640daf3d768435e58333caacc89e115bd0

URL: https://github.com/llvm/llvm-project/commit/6ef37b640daf3d768435e58333caacc89e115bd0
DIFF: https://github.com/llvm/llvm-project/commit/6ef37b640daf3d768435e58333caacc89e115bd0.diff

LOG: [lld/mac] Add test for --lto-O

This belongs to fe08e9c4871, I (thakis) forgot to `git add` it back then.

Differential Revision: https://reviews.llvm.org/D105223

Added: 
    lld/test/MachO/lto-opt-level.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/lld/test/MachO/lto-opt-level.ll b/lld/test/MachO/lto-opt-level.ll
new file mode 100644
index 000000000000..6fd155e460e9
--- /dev/null
+++ b/lld/test/MachO/lto-opt-level.ll
@@ -0,0 +1,28 @@
+; REQUIRES: x86
+
+; RUN: rm -rf %t; mkdir %t
+; RUN: llvm-as  %s -o %t/test.o
+
+; RUN: %lld %t/test.o --lto-O0 -o %t/test
+; RUN: llvm-nm -pa %t/test | FileCheck %s --check-prefixes=CHECK-O0
+
+; RUN: %lld %t/test.o --lto-O2 -o %t/test
+; RUN: llvm-nm -pa %t/test | FileCheck %s --check-prefixes=CHECK-O2
+
+; RUN: %lld %t/test.o -o %t/test
+; RUN: llvm-nm -pa %t/test | FileCheck %s --check-prefixes=CHECK-O2
+
+; CHECK-O0: foo
+; CHECK-O2-NOT: foo
+
+target triple = "x86_64-apple-macosx10.15.0"
+target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+
+define internal void @foo() {
+  ret void
+}
+
+define void @main() {
+  call void @foo()
+  ret void
+}


        


More information about the llvm-commits mailing list