/FIXED:NO is always the default, so that part needs no work.
Also test the interaction of /ORDER: with /INCREMENTAL.
https://reviews.llvm.org/D45091
llvm-svn: 328877
Config->Implib = Arg->getValue();
// Handle /opt.
- bool DoGC = !Args.hasArg(OPT_debug);
- unsigned ICFLevel = 1; // 0: off, 1: limited, 2: on
+ bool DoGC = !Args.hasArg(OPT_debug) || Args.hasArg(OPT_profile);
+ unsigned ICFLevel =
+ Args.hasArg(OPT_profile) ? 0 : 1; // 0: off, 1: limited, 2: on
for (auto *Arg : Args.filtered(OPT_opt)) {
std::string Str = StringRef(Arg->getValue()).lower();
SmallVector<StringRef, 1> Vec;
Args.hasFlag(OPT_allowisolation, OPT_allowisolation_no, true);
Config->Incremental =
Args.hasFlag(OPT_incremental, OPT_incremental_no,
- !Config->DoGC && !Config->DoICF && !Args.hasArg(OPT_order));
+ !Config->DoGC && !Config->DoICF && !Args.hasArg(OPT_order) &&
+ !Args.hasArg(OPT_profile));
Config->NxCompat = Args.hasFlag(OPT_nxcompat, OPT_nxcompat_no, true);
Config->TerminalServerAware = Args.hasFlag(OPT_tsaware, OPT_tsaware_no, true);
Config->DebugDwarf = Args.hasArg(OPT_debug_dwarf);
Config->MapFile = getMapFile(Args);
+ if (Config->Incremental && Args.hasArg(OPT_profile)) {
+ warn("ignoring '/incremental' due to '/profile' specification");
+ Config->Incremental = false;
+ }
+
+ if (Config->Incremental && Args.hasArg(OPT_order)) {
+ warn("ignoring '/incremental' due to '/order' specification");
+ Config->Incremental = false;
+ }
+
if (Config->Incremental && Config->DoGC) {
warn("ignoring '/incremental' because REF is enabled; use '/opt:noref' to "
"disable");
Config->Incremental = false;
}
- if (Config->Incremental && Args.hasArg(OPT_order)) {
- warn("ignoring '/INCREMENTAL' due to '/ORDER' specification");
- Config->Incremental = false;
- }
-
if (errorCount())
return;
# RUN: /include:bar /verbose %t.obj > %t.log 2>&1
# RUN: FileCheck -check-prefix=NOICF %s < %t.log
+# /profile disables ICF.
+# RUN: lld-link /profile /entry:foo /out:%t.exe /subsystem:console \
+# RUN: /include:bar /verbose %t.obj > %t.log 2>&1
+# RUN: FileCheck -check-prefix=NOICF %s < %t.log
+
# /opt:noref disables ICF.
# RUN: lld-link /opt:noref /entry:foo /out:%t.exe /subsystem:console \
# RUN: /include:bar /verbose %t.obj > %t.log 2>&1
# RUN: yaml2obj < %p/Inputs/export.yaml > %t.obj
+
# RUN: lld-link -out:%t.dll -dll %t.obj 2>&1 \
# RUN: | FileCheck -allow-empty -check-prefix=NOWARN %s
# RUN: touch -t 198002011200.00 %t.lib
# RUN: lld-link -out:%t.dll -dll -incremental %t.obj
# RUN: ls -l %t.lib | FileCheck -check-prefix=NOKEEP %s
+# RUN: lld-link -out:%t.dll -dll -incremental -opt:noref,noicf %t.obj 2>&1 \
+# RUN: | FileCheck -allow-empty -check-prefix=NOWARN %s
+# RUN: touch -t 198002011200.00 %t.lib
+# RUN: lld-link -out:%t.dll -dll -incremental -opt:noref,noicf %t.obj
+# RUN: ls -l %t.lib | FileCheck -check-prefix=KEEP %s
+
# RUN: lld-link -out:%t.dll -dll -debug %t.obj 2>&1 \
# RUN: | FileCheck -allow-empty -check-prefix=NOWARN %s
# RUN: touch -t 198002011200.00 %t.lib
# RUN: lld-link -out:%t.dll -dll -incremental -opt:ref %t.obj
# RUN: ls -l %t.lib | FileCheck -check-prefix=NOKEEP %s
+# RUN: touch %t.order
+# RUN: lld-link -out:%t.dll -dll -incremental -opt:noref,noicf %t.obj \
+# RUN: -order:@%t.order 2>&1 | FileCheck -check-prefix=WARN-ORDER %s
+# RUN: touch -t 198002011200.00 %t.lib
+# RUN: lld-link -out:%t.dll -dll -incremental -opt:noref,noicf -order:@%t.order %t.obj
+# RUN: ls -l %t.lib | FileCheck -check-prefix=NOKEEP %s
+
+# RUN: lld-link -out:%t.dll -dll -opt:noref,noicf %t.obj \
+# RUN: -order:@%t.order 2>&1 | FileCheck -allow-empty -check-prefix=NOWARN %s
+# RUN: touch -t 198002011200.00 %t.lib
+# RUN: lld-link -out:%t.dll -dll -opt:noref,noicf -order:@%t.order %t.obj
+# RUN: ls -l %t.lib | FileCheck -check-prefix=NOKEEP %s
+
+# RUN: lld-link -out:%t.dll -dll -incremental -opt:noref,noicf %t.obj \
+# RUN: -profile 2>&1 | FileCheck -check-prefix=WARN-PROFILE %s
+# RUN: touch -t 198002011200.00 %t.lib
+# RUN: lld-link -out:%t.dll -dll -incremental -opt:noref,noicf -profile %t.obj
+# RUN: ls -l %t.lib | FileCheck -check-prefix=NOKEEP %s
+
+# RUN: lld-link -out:%t.dll -dll -opt:noref,noicf %t.obj \
+# RUN: -profile 2>&1 | FileCheck -allow-empty -check-prefix=NOWARN %s
+# RUN: touch -t 198002011200.00 %t.lib
+# RUN: lld-link -out:%t.dll -dll -opt:noref,noicf -profile %t.obj
+# RUN: ls -l %t.lib | FileCheck -check-prefix=NOKEEP %s
+
# RUN: lld-link -out:%t.dll -dll -debug -opt:ref %t.obj 2>&1 \
# RUN: | FileCheck -allow-empty -check-prefix=NOWARN %s
# RUN: touch -t 198002011200.00 %t.lib
# NOWARN-NOT: ignoring '/incremental'
# WARN-ICF: ignoring '/incremental' because ICF is enabled; use '/opt:noicf' to disable
# WARN-REF: ignoring '/incremental' because REF is enabled; use '/opt:noref' to disable
+# WARN-ORDER: ignoring '/incremental' due to '/order' specification
+# WARN-PROFILE: ignoring '/incremental' due to '/profile' specification
# KEEP: {{Feb 1 1980|1980-02-01}}
# NOKEEP-NOT: {{Feb 1 1980|1980-02-01}}
# RUN: yaml2obj < %s > %t.obj
# RUN: lld-link /out:%t.exe /entry:main %t.obj \
-# RUN: /verbose 2>&1 | FileCheck -check-prefix=CHECK1 %s
+# RUN: /verbose 2>&1 | FileCheck -check-prefix=REF %s
+
+# /debug disables the /opt:ref default...
+# RUN: lld-link /out:%t.exe /debug /entry:main %t.obj \
+# RUN: /verbose 2>&1 | FileCheck -check-prefix=NOREF %s
+
+# ...unless /profile is passed as well.
+# RUN: lld-link /out:%t.exe /profile /debug /entry:main %t.obj \
+# RUN: /verbose 2>&1 | FileCheck -check-prefix=REF %s
+
+# RUN: lld-link /out:%t.exe /opt:ref /debug /entry:main %t.obj \
+# RUN: /verbose 2>&1 | FileCheck -check-prefix=REF %s
# RUN: lld-link /out:%t.exe /entry:main %t.obj \
-# RUN: /verbose /opt:noref 2>&1 | FileCheck -check-prefix=CHECK2 %s
+# RUN: /verbose /opt:noref /profile 2>&1 | FileCheck -check-prefix=NOREF %s
-# CHECK1: Discarded unused
-# CHECK2-NOT: Discarded unused
+# REF: Discarded unused
+# NOREF-NOT: Discarded unused
--- !COFF
header: