From de9cab942bf1f91643c2a88d95d9d6a55fc1e77f Mon Sep 17 00:00:00 2001 From: Bruno Cardoso Lopes Date: Fri, 21 Oct 2016 01:49:14 +0000 Subject: [Driver][Darwin] Pass -no_deduplicate to ld64 Recent versions of ld64 run a deduplicate pass, which is on by default. Disable the pass by using -no_deduplicate in certain condition and enhance total compile time. rdar://problem/25455336 llvm-svn: 284798 --- clang/test/Driver/darwin-ld-dedup.c | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 clang/test/Driver/darwin-ld-dedup.c (limited to 'clang/test/Driver') diff --git a/clang/test/Driver/darwin-ld-dedup.c b/clang/test/Driver/darwin-ld-dedup.c new file mode 100644 index 00000000000..a06ca7bebe5 --- /dev/null +++ b/clang/test/Driver/darwin-ld-dedup.c @@ -0,0 +1,46 @@ +// REQUIRES: system-darwin + +// -no_deduplicate is only present from ld64 version 262 and later. +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=261 -O0 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s + +// Add -no_deduplicate when either -O0 or -O1 is explicitly specified +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 -O0 2>&1 | FileCheck -check-prefix=LINK_NODEDUP %s +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 -O1 2>&1 | FileCheck -check-prefix=LINK_NODEDUP %s + +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 -O2 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 -O3 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 -Os 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 -O4 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 -Ofast 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s + +// Add -no_deduplicate when no -O option is specified *and* this is a compile+link +// (implicit -O0) +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 2>&1 | FileCheck -check-prefix=LINK_NODEDUP %s + +// Do *not* add -no_deduplicate when no -O option is specified and this is just a link +// (since we can't imply -O0) +// RUN: rm -f %t.o %t.bin +// RUN: %clang -target x86_64-apple-darwin10 -c -o %t.o %s +// RUN: %clang -target x86_64-apple-darwin10 %t.o -### -mlinker-version=262 \ +// RUN: -o %t.bin 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s +// RUN: %clang -target x86_64-apple-darwin10 %t.o -### -mlinker-version=262 \ +// RUN: -O0 -o %t.bin 2>&1 | FileCheck -check-prefix=LINK_NODEDUP %s +// RUN: %clang -target x86_64-apple-darwin10 %t.o -### -mlinker-version=262 \ +// RUN: -O1 -o %t.bin 2>&1 | FileCheck -check-prefix=LINK_NODEDUP %s +// RUN: %clang -target x86_64-apple-darwin10 %t.o -### -mlinker-version=262 \ +// RUN: -O2 -o %t.bin 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s + +// LINK_NODEDUP: {{ld(.exe)?"}} +// LINK_NODEDUP: "-no_deduplicate" + +// LINK_DEDUP: {{ld(.exe)?"}} +// LINK_DEDUP-NOT: "-no_deduplicate" -- cgit v1.2.3