1304d0d55SRumeet Dhindsa; REQUIRES: x86
2304d0d55SRumeet Dhindsa; Check that changing the output path via thinlto-prefix-replace works
3304d0d55SRumeet Dhindsa; RUN: mkdir -p %t/oldpath
4304d0d55SRumeet Dhindsa; RUN: opt -module-summary %s -o %t/oldpath/thinlto_prefix_replace.o
5304d0d55SRumeet Dhindsa
6304d0d55SRumeet Dhindsa; Ensure that there is no existing file at the new path, so we properly
7304d0d55SRumeet Dhindsa; test the creation of the new file there.
8304d0d55SRumeet Dhindsa; RUN: rm -f %t/newpath/thinlto_prefix_replace.o.thinlto.bc
9304d0d55SRumeet Dhindsa; RUN: ld.lld --plugin-opt=thinlto-index-only --plugin-opt=thinlto-prefix-replace="%t/oldpath/;%t/newpath/" -shared %t/oldpath/thinlto_prefix_replace.o -o %t/thinlto_prefix_replace
10304d0d55SRumeet Dhindsa; RUN: ls %t/newpath/thinlto_prefix_replace.o.thinlto.bc
11304d0d55SRumeet Dhindsa
129f0f36e0SBob Haarman; Check that this also works without the --plugin-opt= prefix.
139f0f36e0SBob Haarman; RUN: rm -f %t/newpath/thinlto_prefix_replace.o.thinlto.bc
14*e20a2159SFangrui Song; RUN: ld.lld --thinlto-index-only --thinlto-prefix-replace="%t/oldpath/;%t/newpath/" -shared %t/oldpath/thinlto_prefix_replace.o -o %t/thinlto_prefix_replace
159f0f36e0SBob Haarman; RUN: ls %t/newpath/thinlto_prefix_replace.o.thinlto.bc
169f0f36e0SBob Haarman
17304d0d55SRumeet Dhindsa; Ensure that lld generates error if prefix replace option does not have 'old;new' format
18304d0d55SRumeet Dhindsa; RUN: rm -f %t/newpath/thinlto_prefix_replace.o.thinlto.bc
1981cebfd0SFangrui Song; RUN: not ld.lld --plugin-opt=thinlto-index-only --plugin-opt=thinlto-prefix-replace=abc:def -shared %t/oldpath/thinlto_prefix_replace.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR
200dd56dcdSRui Ueyama; ERR: --plugin-opt=thinlto-prefix-replace= expects 'old;new' format, but got abc:def
21304d0d55SRumeet Dhindsa
227b1d7937SAmy Huangtarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
23304d0d55SRumeet Dhindsatarget triple = "x86_64-unknown-linux-gnu"
24304d0d55SRumeet Dhindsa
25304d0d55SRumeet Dhindsadefine void @f() {
26304d0d55SRumeet Dhindsaentry:
27304d0d55SRumeet Dhindsa  ret void
28304d0d55SRumeet Dhindsa}
29