[lld] [compiler-rt] [clang] [clang-tools-extra] [mlir] [flang] [openmp] [libcxx] [libc] [llvm] [ELF] --save-temps --lto-emit-asm: derive ELF/asm file names from bitcode file names (PR #78835)
ormris wrote: We're seeing a test failure on our buildbot after this patch landed. Could you take a look? https://lab.llvm.org/buildbot/#/builders/216/builds/33382/steps/7/logs/FAIL__lld__defsym_ll ``` # RUN: at line 4 z:\b\llvm-clang-x86_64-sie-win\build\bin\llvm-as.exe Z:\b\llvm-clang-x86_64-sie-win\llvm-project\lld\test\ELF\lto/Inputs/defsym-bar.ll -o Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp1.o # executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\llvm-as.exe' 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\lld\test\ELF\lto/Inputs/defsym-bar.ll' -o 'Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp1.o' # RUN: at line 5 z:\b\llvm-clang-x86_64-sie-win\build\bin\ld.lld.exe Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp.o Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp1.o -shared -o Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp.so -defsym=bar2=bar3 -save-temps # executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\ld.lld.exe' 'Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp.o' 'Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp1.o' -shared -o 'Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp.so' -defsym=bar2=bar3 -save-temps # RUN: at line 6 z:\b\llvm-clang-x86_64-sie-win\build\bin\llvm-readelf.exe --symbols Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp.so.lto.o | z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe --check-prefix=OBJ Z:\b\llvm-clang-x86_64-sie-win\llvm-project\lld\test\ELF\lto\defsym.ll # executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\llvm-readelf.exe' --symbols 'Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp.so.lto.o' # executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe' --check-prefix=OBJ 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\lld\test\ELF\lto\defsym.ll' # RUN: at line 7 z:\b\llvm-clang-x86_64-sie-win\build\bin\llvm-objdump.exe -d Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp.so | z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe Z:\b\llvm-clang-x86_64-sie-win\llvm-project\lld\test\ELF\lto\defsym.ll # executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\llvm-objdump.exe' -d 'Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp.so' # executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe' 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\lld\test\ELF\lto\defsym.ll' # RUN: at line 10 z:\b\llvm-clang-x86_64-sie-win\build\bin\opt.exe -module-summary Z:\b\llvm-clang-x86_64-sie-win\llvm-project\lld\test\ELF\lto\defsym.ll -o Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp.o # executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\opt.exe' -module-summary 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\lld\test\ELF\lto\defsym.ll' -o 'Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp.o' # RUN: at line 11 z:\b\llvm-clang-x86_64-sie-win\build\bin\opt.exe -module-summary Z:\b\llvm-clang-x86_64-sie-win\llvm-project\lld\test\ELF\lto/Inputs/defsym-bar.ll -o Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp1.o # executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\opt.exe' -module-summary 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\lld\test\ELF\lto/Inputs/defsym-bar.ll' -o 'Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp1.o' # RUN: at line 12 z:\b\llvm-clang-x86_64-sie-win\build\bin\ld.lld.exe Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp.o Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp1.o -shared -o Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp2.so -defsym=bar2=bar3 -save-temps # executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\ld.lld.exe' 'Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp.o' 'Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp1.o' -shared -o 'Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp2.so' -defsym=bar2=bar3 -save-temps # RUN: at line 13 z:\b\llvm-clang-x86_64-sie-win\build\bin\llvm-readelf.exe --symbols Z:\b\llvm-clang-x86_64-sie-win\build\tools\lld\test\ELF\lto\Output\defsym.ll.tmp2.so1.lto.o | z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe --check-prefix=OBJ Z:\b\llvm-clang-x86_64-sie-win\llvm-project\lld\test\ELF\lto\defsym.ll # executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\llvm-readelf.exe' --symbols
[clang] [clang][FatLTO][UnifiedLTO] Pass -enable-matrix to the LTO driver (PR #77829)
https://github.com/ormris closed https://github.com/llvm/llvm-project/pull/77829 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] f626b1f - [clang][FatLTO][UnifiedLTO] Pass -enable-matrix to the LTO driver
Author: Matthew Voss Date: 2024-01-11T16:52:35-08:00 New Revision: f626b1f4ca2a6fd2b6c5eea3b53c15c4502d29fa URL: https://github.com/llvm/llvm-project/commit/f626b1f4ca2a6fd2b6c5eea3b53c15c4502d29fa DIFF: https://github.com/llvm/llvm-project/commit/f626b1f4ca2a6fd2b6c5eea3b53c15c4502d29fa.diff LOG: [clang][FatLTO][UnifiedLTO] Pass -enable-matrix to the LTO driver Unified LTO and Fat LTO do not use the regular LTO prelink pipeline when -flto/-flto=full is specified on the command line, thus they require LowerMatrixIntrinsicsPass to be run during the link stage. To enable this, we pass -enable-matrix to the LTO driver, replicating ThinLTO behavior. This fix was applied to ThinLTO in https://reviews.llvm.org/D153583. This fixes #77621. Added: Modified: clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/matrix.c Removed: diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 2340191ca97d98..385f66f3782bc1 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -736,6 +736,8 @@ void tools::addLTOOptions(const ToolChain , const ArgList , const bool IsAMDGCN = ToolChain.getTriple().isAMDGCN(); const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath()); const Driver = ToolChain.getDriver(); + const bool IsFatLTO = Args.hasArg(options::OPT_ffat_lto_objects); + const bool IsUnifiedLTO = Args.hasArg(options::OPT_funified_lto); if (llvm::sys::path::filename(Linker) != "ld.lld" && llvm::sys::path::stem(Linker) != "ld.lld" && !ToolChain.getTriple().isOSOpenBSD()) { @@ -765,7 +767,7 @@ void tools::addLTOOptions(const ToolChain , const ArgList , } else { // Tell LLD to find and use .llvm.lto section in regular relocatable object // files -if (Args.hasArg(options::OPT_ffat_lto_objects)) +if (IsFatLTO) CmdArgs.push_back("--fat-lto-objects"); } @@ -825,7 +827,8 @@ void tools::addLTOOptions(const ToolChain , const ArgList , // Matrix intrinsic lowering happens at link time with ThinLTO. Enable // LowerMatrixIntrinsicsPass, which is transitively called by // buildThinLTODefaultPipeline under EnableMatrix. - if (IsThinLTO && Args.hasArg(options::OPT_fenable_matrix)) + if ((IsThinLTO || IsFatLTO || IsUnifiedLTO) && +Args.hasArg(options::OPT_fenable_matrix)) CmdArgs.push_back( Args.MakeArgString(Twine(PluginOptPrefix) + "-enable-matrix")); diff --git a/clang/test/Driver/matrix.c b/clang/test/Driver/matrix.c index 15b44ce5a4ec15..4d2624ad39c16e 100644 --- a/clang/test/Driver/matrix.c +++ b/clang/test/Driver/matrix.c @@ -6,3 +6,15 @@ // RUN: %clang -flto=thin -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX // CHECK-THINLTO-MATRIX: "-plugin-opt=-enable-matrix" + +// RUN: %clang -flto -ffat-lto-objects -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX + +// RUN: %clang -flto=thin -ffat-lto-objects -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX + +// RUN: %clang -flto -funified-lto -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX + +// RUN: %clang -flto=thin -funified-lto -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][FatLTO][UnifiedLTO] Pass -enable-matrix to the LTO driver (PR #77829)
https://github.com/ormris updated https://github.com/llvm/llvm-project/pull/77829 >From f626b1f4ca2a6fd2b6c5eea3b53c15c4502d29fa Mon Sep 17 00:00:00 2001 From: Matthew Voss Date: Thu, 11 Jan 2024 12:18:03 -0800 Subject: [PATCH] [clang][FatLTO][UnifiedLTO] Pass -enable-matrix to the LTO driver Unified LTO and Fat LTO do not use the regular LTO prelink pipeline when -flto/-flto=full is specified on the command line, thus they require LowerMatrixIntrinsicsPass to be run during the link stage. To enable this, we pass -enable-matrix to the LTO driver, replicating ThinLTO behavior. This fix was applied to ThinLTO in https://reviews.llvm.org/D153583. This fixes #77621. --- clang/lib/Driver/ToolChains/CommonArgs.cpp | 7 +-- clang/test/Driver/matrix.c | 12 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 2340191ca97d98..385f66f3782bc1 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -736,6 +736,8 @@ void tools::addLTOOptions(const ToolChain , const ArgList , const bool IsAMDGCN = ToolChain.getTriple().isAMDGCN(); const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath()); const Driver = ToolChain.getDriver(); + const bool IsFatLTO = Args.hasArg(options::OPT_ffat_lto_objects); + const bool IsUnifiedLTO = Args.hasArg(options::OPT_funified_lto); if (llvm::sys::path::filename(Linker) != "ld.lld" && llvm::sys::path::stem(Linker) != "ld.lld" && !ToolChain.getTriple().isOSOpenBSD()) { @@ -765,7 +767,7 @@ void tools::addLTOOptions(const ToolChain , const ArgList , } else { // Tell LLD to find and use .llvm.lto section in regular relocatable object // files -if (Args.hasArg(options::OPT_ffat_lto_objects)) +if (IsFatLTO) CmdArgs.push_back("--fat-lto-objects"); } @@ -825,7 +827,8 @@ void tools::addLTOOptions(const ToolChain , const ArgList , // Matrix intrinsic lowering happens at link time with ThinLTO. Enable // LowerMatrixIntrinsicsPass, which is transitively called by // buildThinLTODefaultPipeline under EnableMatrix. - if (IsThinLTO && Args.hasArg(options::OPT_fenable_matrix)) + if ((IsThinLTO || IsFatLTO || IsUnifiedLTO) && +Args.hasArg(options::OPT_fenable_matrix)) CmdArgs.push_back( Args.MakeArgString(Twine(PluginOptPrefix) + "-enable-matrix")); diff --git a/clang/test/Driver/matrix.c b/clang/test/Driver/matrix.c index 15b44ce5a4ec15..4d2624ad39c16e 100644 --- a/clang/test/Driver/matrix.c +++ b/clang/test/Driver/matrix.c @@ -6,3 +6,15 @@ // RUN: %clang -flto=thin -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX // CHECK-THINLTO-MATRIX: "-plugin-opt=-enable-matrix" + +// RUN: %clang -flto -ffat-lto-objects -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX + +// RUN: %clang -flto=thin -ffat-lto-objects -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX + +// RUN: %clang -flto -funified-lto -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX + +// RUN: %clang -flto=thin -funified-lto -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][FatLTO][UnifiedLTO] Pass -enable-matrix to the LTO driver (PR #77829)
https://github.com/ormris updated https://github.com/llvm/llvm-project/pull/77829 >From b8d3ec5cde2b311747aec83d316af370202b37c1 Mon Sep 17 00:00:00 2001 From: Matthew Voss Date: Thu, 11 Jan 2024 12:18:03 -0800 Subject: [PATCH] [clang][FatLTO][UnifiedLTO] Pass -enable-matrix to the LTO driver Unified LTO and Fat LTO do not use the regular LTO prelink pipeline when -flto/-flto=full is specified on the command line, thus they require LowerMatrixIntrinsicsPass to be run during the link stage. To enable this, we pass -enable-matrix to the LTO driver, replicating ThinLTO behavior. This fix was applied to ThinLTO in https://reviews.llvm.org/D153583. This fixes #77621. --- clang/lib/Driver/ToolChains/CommonArgs.cpp | 7 +-- clang/test/Driver/matrix.c | 12 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 2340191ca97d98..385f66f3782bc1 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -736,6 +736,8 @@ void tools::addLTOOptions(const ToolChain , const ArgList , const bool IsAMDGCN = ToolChain.getTriple().isAMDGCN(); const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath()); const Driver = ToolChain.getDriver(); + const bool IsFatLTO = Args.hasArg(options::OPT_ffat_lto_objects); + const bool IsUnifiedLTO = Args.hasArg(options::OPT_funified_lto); if (llvm::sys::path::filename(Linker) != "ld.lld" && llvm::sys::path::stem(Linker) != "ld.lld" && !ToolChain.getTriple().isOSOpenBSD()) { @@ -765,7 +767,7 @@ void tools::addLTOOptions(const ToolChain , const ArgList , } else { // Tell LLD to find and use .llvm.lto section in regular relocatable object // files -if (Args.hasArg(options::OPT_ffat_lto_objects)) +if (IsFatLTO) CmdArgs.push_back("--fat-lto-objects"); } @@ -825,7 +827,8 @@ void tools::addLTOOptions(const ToolChain , const ArgList , // Matrix intrinsic lowering happens at link time with ThinLTO. Enable // LowerMatrixIntrinsicsPass, which is transitively called by // buildThinLTODefaultPipeline under EnableMatrix. - if (IsThinLTO && Args.hasArg(options::OPT_fenable_matrix)) + if ((IsThinLTO || IsFatLTO || IsUnifiedLTO) && +Args.hasArg(options::OPT_fenable_matrix)) CmdArgs.push_back( Args.MakeArgString(Twine(PluginOptPrefix) + "-enable-matrix")); diff --git a/clang/test/Driver/matrix.c b/clang/test/Driver/matrix.c index 15b44ce5a4ec15..4d2624ad39c16e 100644 --- a/clang/test/Driver/matrix.c +++ b/clang/test/Driver/matrix.c @@ -6,3 +6,15 @@ // RUN: %clang -flto=thin -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX // CHECK-THINLTO-MATRIX: "-plugin-opt=-enable-matrix" + +// RUN: %clang -flto -ffat-lto-objects -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX + +// RUN: %clang -flto=thin -ffat-lto-objects -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX + +// RUN: %clang -flto -funified-lto -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX + +// RUN: %clang -flto=thin -funified-lto -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][FatLTO][UnifiedLTO] Pass -enable-matrix to the LTO driver (PR #77829)
ormris wrote: Thanks! I'll make sure to include that review in the commit message. Unified LTO is using the ThinLTO pre-link pipeline, regardless of what's passed to the driver. Since the ThinLTO pre-link pipeline doesn't provide this pass, this option should be required when Unified LTO is used. https://github.com/llvm/llvm-project/pull/77829 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][FatLTO][UnifiedLTO] Pass -enable-matrix to the LTO driver (PR #77829)
https://github.com/ormris created https://github.com/llvm/llvm-project/pull/77829 Unified LTO and Fat LTO do not use the regular LTO prelink pipeline when -flto/-flto=full is specified on the command line, thus they require LowerMatrixIntrinsicsPass to be run during the link stage. To enable this, we pass -enable-matrix to the LTO driver, replicating ThinLTO behavior. This fixes #77621. >From 4f3d4470b696bd4eeb5a59105b4cd5ee741a818f Mon Sep 17 00:00:00 2001 From: Matthew Voss Date: Thu, 11 Jan 2024 12:18:03 -0800 Subject: [PATCH] [clang][FatLTO][UnifiedLTO] Pass -enable-matrix to the LTO driver Unified LTO and Fat LTO do not use the regular LTO prelink pipeline when -flto/-flto=full is specified on the command line, thus they require LowerMatrixIntrinsicsPass to be run during the link stage. To enable this, we pass -enable-matrix to the LTO driver, replicating ThinLTO behavior. This fixes #77621. --- clang/lib/Driver/ToolChains/CommonArgs.cpp | 7 +-- clang/test/Driver/matrix.c | 12 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 2340191ca97d98..385f66f3782bc1 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -736,6 +736,8 @@ void tools::addLTOOptions(const ToolChain , const ArgList , const bool IsAMDGCN = ToolChain.getTriple().isAMDGCN(); const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath()); const Driver = ToolChain.getDriver(); + const bool IsFatLTO = Args.hasArg(options::OPT_ffat_lto_objects); + const bool IsUnifiedLTO = Args.hasArg(options::OPT_funified_lto); if (llvm::sys::path::filename(Linker) != "ld.lld" && llvm::sys::path::stem(Linker) != "ld.lld" && !ToolChain.getTriple().isOSOpenBSD()) { @@ -765,7 +767,7 @@ void tools::addLTOOptions(const ToolChain , const ArgList , } else { // Tell LLD to find and use .llvm.lto section in regular relocatable object // files -if (Args.hasArg(options::OPT_ffat_lto_objects)) +if (IsFatLTO) CmdArgs.push_back("--fat-lto-objects"); } @@ -825,7 +827,8 @@ void tools::addLTOOptions(const ToolChain , const ArgList , // Matrix intrinsic lowering happens at link time with ThinLTO. Enable // LowerMatrixIntrinsicsPass, which is transitively called by // buildThinLTODefaultPipeline under EnableMatrix. - if (IsThinLTO && Args.hasArg(options::OPT_fenable_matrix)) + if ((IsThinLTO || IsFatLTO || IsUnifiedLTO) && +Args.hasArg(options::OPT_fenable_matrix)) CmdArgs.push_back( Args.MakeArgString(Twine(PluginOptPrefix) + "-enable-matrix")); diff --git a/clang/test/Driver/matrix.c b/clang/test/Driver/matrix.c index 15b44ce5a4ec15..4d2624ad39c16e 100644 --- a/clang/test/Driver/matrix.c +++ b/clang/test/Driver/matrix.c @@ -6,3 +6,15 @@ // RUN: %clang -flto=thin -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX // CHECK-THINLTO-MATRIX: "-plugin-opt=-enable-matrix" + +// RUN: %clang -flto -ffat-lto-objects -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX + +// RUN: %clang -flto=thin -ffat-lto-objects -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX + +// RUN: %clang -flto -funified-lto -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX + +// RUN: %clang -flto=thin -funified-lto -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [LTO][CodeGen] Test LTO pipeline choices more thoroughly (PR #65485)
https://github.com/ormris approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/65485 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 2263dfe - [test] Correct PS5 triple in clang :: Driver/unified-lto.c
Author: Matthew Voss Date: 2023-08-30T08:45:16-07:00 New Revision: 2263dfe368ce4925eb9f1fdcd11ff50455f546af URL: https://github.com/llvm/llvm-project/commit/2263dfe368ce4925eb9f1fdcd11ff50455f546af DIFF: https://github.com/llvm/llvm-project/commit/2263dfe368ce4925eb9f1fdcd11ff50455f546af.diff LOG: [test] Correct PS5 triple in clang :: Driver/unified-lto.c Added: Modified: clang/test/Driver/unified-lto.c Removed: diff --git a/clang/test/Driver/unified-lto.c b/clang/test/Driver/unified-lto.c index e16affe2c5efda..3a6fe44f5b32df 100644 --- a/clang/test/Driver/unified-lto.c +++ b/clang/test/Driver/unified-lto.c @@ -6,7 +6,7 @@ // UNIT: "-flto-unit" // NOUNIT-NOT: "-flto-unit" -// RUN: %clang --target=x86_64-sie-prospero -### %s -funified-lto 2>&1 | FileCheck --check-prefix=NOUNILTO %s +// RUN: %clang --target=x86_64-sie-ps5 -### %s -funified-lto 2>&1 | FileCheck --check-prefix=NOUNILTO %s // NOUNILTO: clang: warning: argument unused during compilation: '-funified-lto' // NOUNILTO: "-cc1" // NOUNILTO-NOT: "-funified-lto ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 380dbfd - Revert "Reapply [IR] Mark and/or constant expressions as undesirable"
Author: Matthew Voss Date: 2023-07-26T12:54:07-07:00 New Revision: 380dbfd8cab0c48c46c01b519b908c6ef4d6e775 URL: https://github.com/llvm/llvm-project/commit/380dbfd8cab0c48c46c01b519b908c6ef4d6e775 DIFF: https://github.com/llvm/llvm-project/commit/380dbfd8cab0c48c46c01b519b908c6ef4d6e775.diff LOG: Revert "Reapply [IR] Mark and/or constant expressions as undesirable" This reverts commit 0cab8d20417c0e2ccc1ffc5505e080126f5de8e6. Reverted due to an LTO crash. I've put a reduced test case here: https://github.com/llvm/llvm-project/issues/64114 Added: Modified: clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c llvm/lib/IR/ConstantFold.cpp llvm/lib/IR/Constants.cpp llvm/test/CodeGen/Hexagon/atomic-opaque-basic.ll llvm/test/Transforms/InstCombine/and-xor-or.ll llvm/test/Transforms/InstCombine/and.ll llvm/test/Transforms/InstCombine/bswap-fold.ll llvm/test/Transforms/InstSimplify/ConstProp/constant-expr.ll llvm/test/Transforms/InstSimplify/compare.ll Removed: diff --git a/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c b/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c index 0e0a9b157464a6..551ccc4810bcd3 100644 --- a/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c +++ b/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c @@ -303,8 +303,7 @@ char *one_zero(void) { char *one_one_OK(void) { // CHECK: define{{.*}} ptr @one_one_OK() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: %[[AND:.*]] = and i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0), !nosanitize - // CHECK-SANITIZE-C-NEXT: br i1 %[[AND]], label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize + // CHECK-SANITIZE-C-NEXT: br i1 and (i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE-CPP-NEXT: br i1 xor (i1 icmp eq (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE: [[HANDLER_POINTER_OVERFLOW]]: // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_pointer_overflow_abort(ptr @[[LINE_1100]], i64 1, i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1)) @@ -322,8 +321,7 @@ char *one_one_OK(void) { char *one_allones_BAD(void) { // CHECK: define{{.*}} ptr @one_allones_BAD() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: %[[AND:.*]] = and i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0), !nosanitize - // CHECK-SANITIZE-C-NEXT: br i1 %[[AND]], label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize + // CHECK-SANITIZE-C-NEXT: br i1 and (i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE-CPP-NEXT: br i1 xor (i1 icmp eq (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE: [[HANDLER_POINTER_OVERFLOW]]: // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_pointer_overflow_abort(ptr @[[LINE_1200]], i64 1, i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1)) @@ -392,8 +390,7 @@ char *allones_zero_OK(void) { char *allones_one_BAD(void) { // CHECK: define{{.*}} ptr @allones_one_BAD() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: %[[AND:.*]] = and i1 icmp ne (ptr inttoptr (i64 -1 to ptr), ptr null), icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 -1 to ptr), i64 1) to i64), i64 -1), i64 -1),
[clang] d74421a - Remove Clang :: CodeGenCXX/unified-cfi-lto.cpp due to buildbot failures
Author: Matthew Voss Date: 2023-07-13T11:04:32-07:00 New Revision: d74421a29040d728e43f38ffa003d6cc22fbd0c6 URL: https://github.com/llvm/llvm-project/commit/d74421a29040d728e43f38ffa003d6cc22fbd0c6 DIFF: https://github.com/llvm/llvm-project/commit/d74421a29040d728e43f38ffa003d6cc22fbd0c6.diff LOG: Remove Clang :: CodeGenCXX/unified-cfi-lto.cpp due to buildbot failures This test has been failing on sanitizer-x86_64-linux-bootstrap-asan since it was commited. Removing this test while I work on reproducing this. Example: https://lab.llvm.org/buildbot/#/builders/168/builds/14579 Added: Modified: Removed: clang/test/CodeGenCXX/unified-cfi-lto.cpp diff --git a/clang/test/CodeGenCXX/unified-cfi-lto.cpp b/clang/test/CodeGenCXX/unified-cfi-lto.cpp deleted file mode 100644 index 2c518e8e014c44..00 --- a/clang/test/CodeGenCXX/unified-cfi-lto.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// Ensure that the frontend adds the proper metadata when CFI is -// enabled. -// RUN: %clang --target=x86_64-scei-ps4 -funified-lto -flto -fsanitize=cfi -fvisibility=hidden -fno-sanitize-ignorelist -c %s -o %t.o -// RUN: llvm-dis %t.o -o %t1 -// RUN: FileCheck <%t1.0 %s - -typedef int (*FuncPtr)(); - -int a() { return 1; } -int b() { return 2; } -int c() { return 3; } - -FuncPtr func[3] = {a,b,c}; - -int -main(int argc, char *argv[]) { - // CHECK: call i1 @llvm.type.test - return func[argc](); - // CHECK-LABEL: trap -} - -// CHECK: typeTests: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 5007c78 - [PS4][clang] Fix -funified-lto/-flto-unit default on PS4
Author: Matthew Voss Date: 2023-07-12T15:32:40-07:00 New Revision: 5007c78ce0936824972ec6ba3cfa598192087ee1 URL: https://github.com/llvm/llvm-project/commit/5007c78ce0936824972ec6ba3cfa598192087ee1 DIFF: https://github.com/llvm/llvm-project/commit/5007c78ce0936824972ec6ba3cfa598192087ee1.diff LOG: [PS4][clang] Fix -funified-lto/-flto-unit default on PS4 If -funified-lto was specified but -flto was not, we would end up with a situation where the driver thought that Unified LTO was enabled, but the flag was not passed to the frontend. The check disabling -flto-unit for PS4 should use the correct method to check for the target. This only effects PS targets. Added: Modified: clang/lib/Driver/ToolChains/Clang.cpp clang/test/Driver/lto-unit.c Removed: diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 7abd03ab87be8d..ce0e3aa2b3d325 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4776,10 +4776,10 @@ void Clang::ConstructJob(Compilation , const JobAction , // Select the appropriate action. RewriteKind rewriteKind = RK_None; - bool UnifiedLTO = Triple.isPS();; + bool UnifiedLTO = false; if (IsUsingLTO) { UnifiedLTO = Args.hasFlag(options::OPT_funified_lto, - options::OPT_fno_unified_lto, false); + options::OPT_fno_unified_lto, Triple.isPS()); if (UnifiedLTO) CmdArgs.push_back("-funified-lto"); } @@ -4930,7 +4930,7 @@ void Clang::ConstructJob(Compilation , const JobAction , Twine("-flto=") + (LTOMode == LTOK_Thin ? "thin" : "full"))); // PS4 uses the legacy LTO API, which does not support some of the // features enabled by -flto-unit. -if ((RawTriple.getOS() != llvm::Triple::PS4) || +if (!RawTriple.isPS4() || (D.getLTOMode() == LTOK_Full) || !UnifiedLTO) CmdArgs.push_back("-flto-unit"); } diff --git a/clang/test/Driver/lto-unit.c b/clang/test/Driver/lto-unit.c index 14eadaf8ad4d26..b2edb5eab079e8 100644 --- a/clang/test/Driver/lto-unit.c +++ b/clang/test/Driver/lto-unit.c @@ -2,8 +2,8 @@ // RUN: %clang --target=x86_64-unknown-linux -### %s -flto=thin 2>&1 | FileCheck --check-prefix=UNIT %s // RUN: %clang --target=x86_64-apple-darwin13.3.0 -### %s -flto=full 2>&1 | FileCheck --check-prefix=UNIT %s // RUN: %clang --target=x86_64-apple-darwin13.3.0 -### %s -flto=thin 2>&1 | FileCheck --check-prefix=UNIT %s -// RUN: %clang --target=x86_64-scei-ps4 -### %s -flto=full 2>&1 | FileCheck --check-prefix=UNIT %s -// RUN: %clang --target=x86_64-scei-ps4 -### %s -flto=thin 2>&1 | FileCheck --check-prefix=UNIT %s +// RUN: %clang --target=x86_64-scei-ps4 -### %s -flto=full -fno-unified-lto 2>&1 | FileCheck --check-prefix=UNIT %s +// RUN: %clang --target=x86_64-scei-ps4 -### %s -flto=thin -fno-unified-lto 2>&1 | FileCheck --check-prefix=UNIT %s // RUN: %clang --target=x86_64-scei-ps4 -### %s -flto=full -funified-lto 2>&1 | FileCheck --check-prefix=UNIT %s // RUN: %clang --target=x86_64-scei-ps4 -### %s -flto=thin -funified-lto 2>&1 | FileCheck --check-prefix=NOUNIT %s // RUN: %clang --target=x86_64-unknown-linux -### %s -flto=full -funified-lto 2>&1 | FileCheck --check-prefix=UNIT %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 392b306 - [clang][PS4] Enable SplitLTOUnits and Unified LTO by default
Author: Matthew Voss Date: 2023-07-11T16:25:07-07:00 New Revision: 392b3068075279c7e321583c4d426edf15c935ca URL: https://github.com/llvm/llvm-project/commit/392b3068075279c7e321583c4d426edf15c935ca DIFF: https://github.com/llvm/llvm-project/commit/392b3068075279c7e321583c4d426edf15c935ca.diff LOG: [clang][PS4] Enable SplitLTOUnits and Unified LTO by default - Unified LTO default for all PlayStation targets - Add default case to tests - SplitLTOUnit not default for PS4 - Remove ignorelist requirement to address buildbot failures Differential Revision: https://reviews.llvm.org/D123971 Added: Modified: clang/lib/Driver/ToolChains/Clang.cpp clang/test/CodeGen/split-lto-unit.c clang/test/CodeGenCXX/unified-cfi-lto.cpp clang/test/Driver/lto-unit.c clang/test/Driver/split-lto-unit.c Removed: diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 890b99d916f116..796c60f0739285 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4776,7 +4776,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // Select the appropriate action. RewriteKind rewriteKind = RK_None; - bool UnifiedLTO = false; + bool UnifiedLTO = Triple.isPS();; if (IsUsingLTO) { UnifiedLTO = Args.hasFlag(options::OPT_funified_lto, options::OPT_fno_unified_lto, false); @@ -7343,7 +7343,8 @@ void Clang::ConstructJob(Compilation , const JobAction , bool DefaultsSplitLTOUnit = (WholeProgramVTables || SanitizeArgs.needsLTO()) && - (LTOMode == LTOK_Full || TC.canSplitThinLTOUnit()); + (LTOMode == LTOK_Full || TC.canSplitThinLTOUnit()) || + (!Triple.isPS4() && UnifiedLTO); bool SplitLTOUnit = Args.hasFlag(options::OPT_fsplit_lto_unit, options::OPT_fno_split_lto_unit, DefaultsSplitLTOUnit); diff --git a/clang/test/CodeGen/split-lto-unit.c b/clang/test/CodeGen/split-lto-unit.c index b1560b61f3e30b..aaa3511d183bcf 100644 --- a/clang/test/CodeGen/split-lto-unit.c +++ b/clang/test/CodeGen/split-lto-unit.c @@ -1,6 +1,7 @@ // ; Check that -flto=thin without -fsplit-lto-unit has EnableSplitLTOUnit = 0 // RUN: %clang_cc1 -flto=thin -emit-llvm-bc < %s | llvm-dis -o - | FileCheck %s // RUN: %clang_cc1 -flto=thin -emit-llvm < %s | FileCheck %s +// RUN: %clang_cc1 -flto=thin -funified-lto -triple=x86_64-scei-ps4 -emit-llvm-bc < %s | llvm-dis -o - | FileCheck %s // CHECK: !{i32 1, !"EnableSplitLTOUnit", i32 0} // // ; Check that -flto=thin with -fsplit-lto-unit has EnableSplitLTOUnit = 1 @@ -12,4 +13,9 @@ // RUN: %clang_cc1 -flto -triple x86_64-pc-linux-gnu -emit-llvm-bc < %s | llvm-dis -o - | FileCheck %s --implicit-check-not="EnableSplitLTOUnit" --check-prefix=SPLIT // RUN: %clang_cc1 -flto -triple x86_64-pc-linux-gnu -emit-llvm < %s | FileCheck %s --implicit-check-not="EnableSplitLTOUnit" --check-prefix=SPLIT +// ; Check that regular LTO has EnableSplitLTOUnit = 1, if using distinct pipelines. For unified pipelines, use EnableSplitLTOUnit = 0. +// RUN: %clang_cc1 -flto -triple x86_64-pc-linux-gnu -emit-llvm-bc < %s | llvm-dis -o - | FileCheck %s --implicit-check-not="EnableSplitLTOUnit" --check-prefix=SPLIT +// RUN: %clang_cc1 -flto -funified-lto -triple x86_64-scei-ps4 -emit-llvm-bc < %s | llvm-dis -o - | FileCheck %s +// RUN: %clang_cc1 -flto=thin -funified-lto -fsplit-lto-unit -triple x86_64-pc-linux-gnu -emit-llvm-bc < %s | llvm-dis -o - | FileCheck %s --implicit-check-not="EnableSplitLTOUnit" --check-prefix=SPLIT + int main(void) {} diff --git a/clang/test/CodeGenCXX/unified-cfi-lto.cpp b/clang/test/CodeGenCXX/unified-cfi-lto.cpp index cc3f594533ae1b..2c518e8e014c44 100644 --- a/clang/test/CodeGenCXX/unified-cfi-lto.cpp +++ b/clang/test/CodeGenCXX/unified-cfi-lto.cpp @@ -1,6 +1,6 @@ // Ensure that the frontend adds the proper metadata when CFI is // enabled. -// RUN: %clang --target=x86_64-scei-ps4 -funified-lto -flto -fsanitize=cfi -fvisibility=hidden -c %s -o %t.o +// RUN: %clang --target=x86_64-scei-ps4 -funified-lto -flto -fsanitize=cfi -fvisibility=hidden -fno-sanitize-ignorelist -c %s -o %t.o // RUN: llvm-dis %t.o -o %t1 // RUN: FileCheck <%t1.0 %s diff --git a/clang/test/Driver/lto-unit.c b/clang/test/Driver/lto-unit.c index 43a9c24088ed11..14eadaf8ad4d26 100644 --- a/clang/test/Driver/lto-unit.c +++ b/clang/test/Driver/lto-unit.c @@ -4,5 +4,10 @@ // RUN: %clang --target=x86_64-apple-darwin13.3.0 -### %s -flto=thin 2>&1 | FileCheck --check-prefix=UNIT %s // RUN: %clang --target=x86_64-scei-ps4 -### %s -flto=full 2>&1 | FileCheck --check-prefix=UNIT %s // RUN: %clang --target=x86_64-scei-ps4 -### %s -flto=thin 2>&1 | FileCheck --check-prefix=UNIT %s +// RUN: %clang --target=x86_64-scei-ps4 -### %s -flto=full -funified-lto 2>&1 | FileCheck --check-prefix=UNIT %s +// RUN:
[clang] 048a0c2 - [clang] Support Unified LTO Bitcode Frontend
Author: Matthew Voss Date: 2023-07-11T15:13:57-07:00 New Revision: 048a0c246908291c82d2f4531d3df45a4c4a8a18 URL: https://github.com/llvm/llvm-project/commit/048a0c246908291c82d2f4531d3df45a4c4a8a18 DIFF: https://github.com/llvm/llvm-project/commit/048a0c246908291c82d2f4531d3df45a4c4a8a18.diff LOG: [clang] Support Unified LTO Bitcode Frontend The unified LTO pipeline creates a single LTO bitcode structure that can be used by Thin or Full LTO. This means that the LTO mode can be chosen at link time and that all LTO bitcode produced by the pipeline is compatible, from an optimization perspective. This makes the behavior of LTO a bit more predictable by normalizing the set of LTO features supported by each LTO bitcode file. Example usage: # Compile and link. Select regular LTO at link time. clang -flto -funified-lto -fuse-ld=lld foo.c # Compile and link. Select ThinLTO at link time. clang -flto=thin -funified-lto -fuse-ld=lld foo.c # Link separately, using ThinLTO. clang -c -flto -funified-lto foo.c # -flto={full,thin} are identical in terms of compilation actions clang -flto=thin -fuse-ld=lld foo.o # pass --lto=thin to ld.lld # Link separately, using regular LTO. clang -c -flto -funified-lto foo.c clang -flto -fuse-ld=lld foo.o # pass --lto=full to ld.lld The RFC discussing the details and rational for this change is here: https://discourse.llvm.org/t/rfc-a-unified-lto-bitcode-frontend/61774 Added: clang/test/CodeGen/asan-unified-lto.ll clang/test/CodeGen/unified-lto-pipeline.c clang/test/CodeGenCXX/unified-cfi-lto.cpp clang/test/Driver/unified-lto.c Modified: clang/include/clang/Basic/CodeGenOptions.def clang/include/clang/Driver/Options.td clang/lib/CodeGen/BackendUtil.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Driver/ToolChains/PS4CPU.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/test/CodeGen/emit-summary-index.c clang/test/Driver/whole-program-vtables.c Removed: diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def index 5b18f45a04ab1a..a03447ca2931e2 100644 --- a/clang/include/clang/Basic/CodeGenOptions.def +++ b/clang/include/clang/Basic/CodeGenOptions.def @@ -168,6 +168,7 @@ CODEGENOPT(EnableSplitLTOUnit, 1, 0) ///< Enable LTO unit splitting to support /// CFI and traditional whole program /// devirtualization that require whole /// program IR support. +CODEGENOPT(UnifiedLTO, 1, 0) ///< Use the unified LTO pipeline. CODEGENOPT(IncrementalLinkerCompatible, 1, 0) ///< Emit an object file which can ///< be used with an incremental ///< linker. diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index c5230d11baeddf..aacdf09bec1e6f 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -2341,6 +2341,11 @@ def flto_EQ_auto : Flag<["-"], "flto=auto">, Group, Alias, AliasArgs<["full"]>, HelpText<"Enable LTO in 'full' mode">; def flto : Flag<["-"], "flto">, Flags<[CoreOption, CC1Option, FC1Option, FlangOption]>, Group, Alias, AliasArgs<["full"]>, HelpText<"Enable LTO in 'full' mode">; +defm unified_lto : BoolFOption<"unified-lto", + CodeGenOpts<"UnifiedLTO">, DefaultFalse, + PosFlag, + NegFlag, + BothFlags<[CC1Option], "">>; def fno_lto : Flag<["-"], "fno-lto">, Flags<[CoreOption, CC1Option]>, Group, HelpText<"Disable LTO mode (default)">; def foffload_lto_EQ : Joined<["-"], "foffload-lto=">, Flags<[CoreOption]>, Group, diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 06af08023d1be9..1b0c249f440899 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -831,6 +831,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline( // Only enable CGProfilePass when using integrated assembler, since // non-integrated assemblers don't recognize .cgprofile section. PTO.CallGraphProfile = !CodeGenOpts.DisableIntegratedAS; + PTO.UnifiedLTO = CodeGenOpts.UnifiedLTO; LoopAnalysisManager LAM; FunctionAnalysisManager FAM; @@ -1010,7 +1011,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline( }); } -if (IsThinLTO) { +if (IsThinLTO || (IsLTO && CodeGenOpts.UnifiedLTO)) { MPM = PB.buildThinLTOPreLinkDefaultPipeline(Level); } else if (IsLTO) { MPM = PB.buildLTOPreLinkDefaultPipeline(Level); @@ -1036,8 +1037,10 @@ void EmitAssemblyHelper::RunOptimizationPipeline( if (!ThinLinkOS) return; } -MPM.addPass(ThinLTOBitcodeWriterPass(*OS, ThinLinkOS ? >os() -
[clang] 393a1c3 - [PS4][clang] Pass -flto-jobs argument to orbis-ld
Author: Matthew Voss Date: 2023-04-11T10:33:16-07:00 New Revision: 393a1c3b4fcded56a1078d2c01c69af2f2ec05cf URL: https://github.com/llvm/llvm-project/commit/393a1c3b4fcded56a1078d2c01c69af2f2ec05cf DIFF: https://github.com/llvm/llvm-project/commit/393a1c3b4fcded56a1078d2c01c69af2f2ec05cf.diff LOG: [PS4][clang] Pass -flto-jobs argument to orbis-ld Pass -flto-jobs to orbis-ld correctly. Differential Revision: https://reviews.llvm.org/D147660 Added: Modified: clang/lib/Driver/ToolChains/PS4CPU.cpp clang/test/Driver/lto-jobs.c Removed: diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp b/clang/lib/Driver/ToolChains/PS4CPU.cpp index 71c6b650e1f52..b280abb0d58b7 100644 --- a/clang/lib/Driver/ToolChains/PS4CPU.cpp +++ b/clang/lib/Driver/ToolChains/PS4CPU.cpp @@ -180,6 +180,14 @@ void tools::PScpu::Linker::ConstructJob(Compilation , const JobAction , if (Arg *A = Args.getLastArg(options::OPT_fcrash_diagnostics_dir)) AddCodeGenFlag(Twine("-crash-diagnostics-dir=") + A->getValue()); +StringRef Parallelism = getLTOParallelism(Args, D); +if (!Parallelism.empty()) { + if (IsPS4) +AddCodeGenFlag(Twine("-threads=") + Parallelism); + else +CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=jobs=") + Parallelism)); +} + if (IsPS4) { const char *Prefix = nullptr; if (D.getLTOMode() == LTOK_Thin) @@ -193,12 +201,6 @@ void tools::PScpu::Linker::ConstructJob(Compilation , const JobAction , } } - if (IsPS5 && UseLTO) { -StringRef Parallelism = getLTOParallelism(Args, D); -if (!Parallelism.empty()) - CmdArgs.push_back(Args.MakeArgString("-plugin-opt=jobs=" + Parallelism)); - } - if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) TC.addSanitizerArgs(Args, CmdArgs, "-l", ""); diff --git a/clang/test/Driver/lto-jobs.c b/clang/test/Driver/lto-jobs.c index 443f8abced788..5402442ce6972 100644 --- a/clang/test/Driver/lto-jobs.c +++ b/clang/test/Driver/lto-jobs.c @@ -7,6 +7,11 @@ // RUN: FileCheck -check-prefix=CHECK-LINK-THIN-JOBS-ACTION < %t %s // // CHECK-LINK-THIN-JOBS-ACTION: "-plugin-opt=jobs=5" +// +// RUN: %clang -target x86_64-scei-ps4 -### %s -flto=thin -flto-jobs=5 2> %t +// RUN: FileCheck -check-prefix=CHECK-PS4-LINK-THIN-JOBS-ACTION < %t %s +// +// CHECK-PS4-LINK-THIN-JOBS-ACTION: "-lto-thin-debug-options= -generate-arange-section -threads=5" // RUN: %clang -target x86_64-apple-darwin13.3.0 -### %s -flto=thin -flto-jobs=5 2> %t // RUN: FileCheck -check-prefix=CHECK-LINK-THIN-JOBS2-ACTION < %t %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c61f45f - Update clang :: Driver/debug-options.c to fix the buildbots
Author: Matthew Voss Date: 2023-04-05T13:27:17-07:00 New Revision: c61f45fc3e041606c5b94c468a5c092e8a6e5601 URL: https://github.com/llvm/llvm-project/commit/c61f45fc3e041606c5b94c468a5c092e8a6e5601 DIFF: https://github.com/llvm/llvm-project/commit/c61f45fc3e041606c5b94c468a5c092e8a6e5601.diff LOG: Update clang :: Driver/debug-options.c to fix the buildbots The format of the LTO debug options generated for orbis-ld changed, breaking this test. https://lab.llvm.org/buildbot/#/builders/230/builds/11367 Added: Modified: clang/test/Driver/debug-options.c Removed: diff --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c index dedd96c82da96..8617949cea1c8 100644 --- a/clang/test/Driver/debug-options.c +++ b/clang/test/Driver/debug-options.c @@ -390,8 +390,8 @@ // LDGARANGE: {{".*ld.*"}} {{.*}} // LDGARANGE-NOT: "-plugin-opt=-generate-arange-section" // LLDGARANGE: {{".*lld.*"}} {{.*}} "-plugin-opt=-generate-arange-section" -// SNLDTLTOGARANGE: {{".*orbis-ld.*"}} {{.*}} "-lto-thin-debug-options=-generate-arange-section" -// SNLDFLTOGARANGE: {{".*orbis-ld.*"}} {{.*}} "-lto-debug-options=-generate-arange-section" +// SNLDTLTOGARANGE: {{".*orbis-ld.*"}} {{.*}} "-lto-thin-debug-options= -generate-arange-section" +// SNLDFLTOGARANGE: {{".*orbis-ld.*"}} {{.*}} "-lto-debug-options= -generate-arange-section" // PUB: -gpubnames // ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c37b95b - [PS4][clang] Fix the format of the LTO debug options passed to orbis-ld
Author: Matthew Voss Date: 2023-04-05T12:57:21-07:00 New Revision: c37b95b515a5c69b2050c8fd50f076368742c6cb URL: https://github.com/llvm/llvm-project/commit/c37b95b515a5c69b2050c8fd50f076368742c6cb DIFF: https://github.com/llvm/llvm-project/commit/c37b95b515a5c69b2050c8fd50f076368742c6cb.diff LOG: [PS4][clang] Fix the format of the LTO debug options passed to orbis-ld Currently, we pass multiple LTO debug options to orbis-ld like this: orbis-ld --lto=thin --lto-thin-debug-options= --lto-thin-debug-options= ... When it should be like this: orbis-ld --lto=thin "--lto-thin-debug-options= " ... Differential Revision: https://reviews.llvm.org/D147546 Added: Modified: clang/lib/Driver/ToolChains/PS4CPU.cpp clang/test/Driver/ps4-ps5-linker.c Removed: diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp b/clang/lib/Driver/ToolChains/PS4CPU.cpp index 8c8b7c73c1bf5..71c6b650e1f52 100644 --- a/clang/lib/Driver/ToolChains/PS4CPU.cpp +++ b/clang/lib/Driver/ToolChains/PS4CPU.cpp @@ -160,18 +160,12 @@ void tools::PScpu::Linker::ConstructJob(Compilation , const JobAction , const bool IsPS5 = TC.getTriple().isPS5(); assert(IsPS4 || IsPS5); + const char *PS4LTOArgs = ""; auto AddCodeGenFlag = [&](Twine Flag) { -const char *Prefix = nullptr; -if (IsPS4 && D.getLTOMode() == LTOK_Thin) - Prefix = "-lto-thin-debug-options="; -else if (IsPS4 && D.getLTOMode() == LTOK_Full) - Prefix = "-lto-debug-options="; +if (IsPS4) + PS4LTOArgs = Args.MakeArgString(Twine(PS4LTOArgs) + " " + Flag); else if (IsPS5) - Prefix = "-plugin-opt="; -else - llvm_unreachable("new LTO mode?"); - -CmdArgs.push_back(Args.MakeArgString(Twine(Prefix) + Flag)); + CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=") + Flag)); }; if (UseLTO) { @@ -185,6 +179,18 @@ void tools::PScpu::Linker::ConstructJob(Compilation , const JobAction , if (Arg *A = Args.getLastArg(options::OPT_fcrash_diagnostics_dir)) AddCodeGenFlag(Twine("-crash-diagnostics-dir=") + A->getValue()); + +if (IsPS4) { + const char *Prefix = nullptr; + if (D.getLTOMode() == LTOK_Thin) +Prefix = "-lto-thin-debug-options="; + else if (D.getLTOMode() == LTOK_Full) +Prefix = "-lto-debug-options="; + else +llvm_unreachable("new LTO mode?"); + + CmdArgs.push_back(Args.MakeArgString(Twine(Prefix) + PS4LTOArgs)); +} } if (IsPS5 && UseLTO) { diff --git a/clang/test/Driver/ps4-ps5-linker.c b/clang/test/Driver/ps4-ps5-linker.c index ee8e96bbfbd02..8aae94c838834 100644 --- a/clang/test/Driver/ps4-ps5-linker.c +++ b/clang/test/Driver/ps4-ps5-linker.c @@ -7,8 +7,8 @@ // RUN: %clang --target=x86_64-scei-ps5 -flto -fjmc %s -### 2>&1 | FileCheck --check-prefixes=CHECK-PS5-LTO,CHECK-PS5-LIB %s // CHECK-PS4-NOT: -enable-jmc-instrument -// CHECK-PS4-THIN-LTO: -lto-thin-debug-options=-enable-jmc-instrument -// CHECK-PS4-FULL-LTO: -lto-debug-options=-enable-jmc-instrument +// CHECK-PS4-THIN-LTO: "-lto-thin-debug-options= -generate-arange-section -enable-jmc-instrument" +// CHECK-PS4-FULL-LTO: "-lto-debug-options= -generate-arange-section -enable-jmc-instrument" // CHECK-PS5-NOT: -plugin-opt=-enable-jmc-instrument // CHECK-PS5-LTO: -plugin-opt=-enable-jmc-instrument @@ -23,7 +23,7 @@ // RUN: %clang --target=x86_64-scei-ps5 -fcrash-diagnostics-dir=mydumps %s -### 2>&1 | FileCheck --check-prefixes=CHECK-DIAG-PS5 %s // RUN: %clang --target=x86_64-scei-ps5 -flto -fcrash-diagnostics-dir=mydumps %s -### 2>&1 | FileCheck --check-prefixes=CHECK-DIAG-PS5-LTO %s -// CHECK-DIAG-PS4-THIN-LTO: -lto-thin-debug-options=-crash-diagnostics-dir=mydumps -// CHECK-DIAG-PS4-FULL-LTO: -lto-debug-options=-crash-diagnostics-dir=mydumps +// CHECK-DIAG-PS4-THIN-LTO: "-lto-thin-debug-options= -generate-arange-section -crash-diagnostics-dir=mydumps" +// CHECK-DIAG-PS4-FULL-LTO: "-lto-debug-options= -generate-arange-section -crash-diagnostics-dir=mydumps" // CHECK-DIAG-PS5-NOT: -plugin-opt=-crash-diagnostics-dir=mydumps // CHECK-DIAG-PS5-LTO: -plugin-opt=-crash-diagnostics-dir=mydumps ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] bbc204b - [PS4][clang] Limit ThinLTO parallelism when requested
Author: Matthew Voss Date: 2023-03-29T09:36:46-07:00 New Revision: bbc204b944eea829a029268fff37faabdf61fcaf URL: https://github.com/llvm/llvm-project/commit/bbc204b944eea829a029268fff37faabdf61fcaf DIFF: https://github.com/llvm/llvm-project/commit/bbc204b944eea829a029268fff37faabdf61fcaf.diff LOG: [PS4][clang] Limit ThinLTO parallelism when requested Pass the correct option to the linker when "-flto-jobs=" is passed to the driver. Added: Modified: clang/lib/Driver/ToolChains/PS4CPU.cpp clang/test/Driver/lto-jobs.c Removed: diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp b/clang/lib/Driver/ToolChains/PS4CPU.cpp index b3e14618f307e..8c8b7c73c1bf5 100644 --- a/clang/lib/Driver/ToolChains/PS4CPU.cpp +++ b/clang/lib/Driver/ToolChains/PS4CPU.cpp @@ -187,6 +187,12 @@ void tools::PScpu::Linker::ConstructJob(Compilation , const JobAction , AddCodeGenFlag(Twine("-crash-diagnostics-dir=") + A->getValue()); } + if (IsPS5 && UseLTO) { +StringRef Parallelism = getLTOParallelism(Args, D); +if (!Parallelism.empty()) + CmdArgs.push_back(Args.MakeArgString("-plugin-opt=jobs=" + Parallelism)); + } + if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) TC.addSanitizerArgs(Args, CmdArgs, "-l", ""); diff --git a/clang/test/Driver/lto-jobs.c b/clang/test/Driver/lto-jobs.c index c28d0ad300f4e..443f8abced788 100644 --- a/clang/test/Driver/lto-jobs.c +++ b/clang/test/Driver/lto-jobs.c @@ -3,6 +3,9 @@ // RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin -flto-jobs=5 2> %t // RUN: FileCheck -check-prefix=CHECK-LINK-THIN-JOBS-ACTION < %t %s // +// RUN: %clang -target x86_64-sie-ps5 -### %s -flto=thin -flto-jobs=5 2> %t +// RUN: FileCheck -check-prefix=CHECK-LINK-THIN-JOBS-ACTION < %t %s +// // CHECK-LINK-THIN-JOBS-ACTION: "-plugin-opt=jobs=5" // RUN: %clang -target x86_64-apple-darwin13.3.0 -### %s -flto=thin -flto-jobs=5 2> %t ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 45c7da2 - [PS4] Always enable the .debug_aranges section when using LTO
Author: Matthew Voss Date: 2022-09-20T14:44:56-07:00 New Revision: 45c7da241f124d49abdc0598d381d96d15918834 URL: https://github.com/llvm/llvm-project/commit/45c7da241f124d49abdc0598d381d96d15918834 DIFF: https://github.com/llvm/llvm-project/commit/45c7da241f124d49abdc0598d381d96d15918834.diff LOG: [PS4] Always enable the .debug_aranges section when using LTO This flag enables the .debug_aranges section by passing a flag to LLD and our internal linker. This also adds a new routine that will generate the correct flag for our internal linker or set of flags for LLD when given a list of LLVM options. That ensures multiple LLVM codegen options can be passed to either linker consistently. Differential Revision: https://reviews.llvm.org/D134296 Added: Modified: clang/lib/Driver/ToolChains/PS4CPU.cpp clang/test/Driver/debug-options.c clang/test/Driver/ps4-ps5-linker-jmc.c Removed: diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp b/clang/lib/Driver/ToolChains/PS4CPU.cpp index 97688470008f..fc905ff74fd7 100644 --- a/clang/lib/Driver/ToolChains/PS4CPU.cpp +++ b/clang/lib/Driver/ToolChains/PS4CPU.cpp @@ -159,17 +159,32 @@ void tools::PScpu::Linker::ConstructJob(Compilation , const JobAction , const bool IsPS5 = TC.getTriple().isPS5(); assert(IsPS4 || IsPS5); + ArgStringList DbgOpts; + // This tells LTO to perform JustMyCode instrumentation. - if (UseLTO && UseJMC) { -if (IsPS4 && D.getLTOMode() == LTOK_Thin) { - CmdArgs.push_back("-lto-thin-debug-options=-enable-jmc-instrument"); -} else if (IsPS4 && D.getLTOMode() == LTOK_Full) { - CmdArgs.push_back("-lto-debug-options=-enable-jmc-instrument"); -} else if (IsPS5) { - CmdArgs.push_back("-mllvm"); - CmdArgs.push_back("-enable-jmc-instrument"); -} else - llvm_unreachable("new LTO mode?"); + if (UseLTO && UseJMC) +DbgOpts.push_back("-enable-jmc-instrument"); + + // We default to creating the arange section, but LTO does not. Enable it + // here. + if (UseLTO) +DbgOpts.push_back("-generate-arange-section"); + + if (UseLTO) { +if (IsPS4) { + StringRef F = (D.getLTOMode() == LTOK_Thin) ? + "-lto-thin-debug-options=" : "-lto-debug-options="; + F = makeArgString(Args, F.data(), DbgOpts.front(), ""); + DbgOpts.erase(DbgOpts.begin()); + for (auto X : DbgOpts) +F = makeArgString(Args, F.data(), " ", X); + CmdArgs.push_back(F.data()); +} else { + for (auto D : DbgOpts) { +CmdArgs.push_back("-mllvm"); +CmdArgs.push_back(D); + } +} } if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) diff --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c index 04004716aa50..96c0763fbf9c 100644 --- a/clang/test/Driver/debug-options.c +++ b/clang/test/Driver/debug-options.c @@ -107,6 +107,14 @@ // RUN: | FileCheck -check-prefix=CI %s // RUN: %clang -### -c %s -gsce -target x86_64-unknown-linux 2>&1 \ // RUN: | FileCheck -check-prefix=NOCI %s +// RUN: %clang -### %s -g -flto=thin -target x86_64-scei-ps4 2>&1 \ +// RUN: | FileCheck -check-prefix=SNLDTLTOGARANGE %s +// RUN: %clang -### %s -g -flto=full -target x86_64-scei-ps4 2>&1 \ +// RUN: | FileCheck -check-prefix=SNLDFLTOGARANGE %s +// RUN: %clang -### %s -g -flto -target x86_64-scei-ps5 2>&1 \ +// RUN: | FileCheck -check-prefix=LLDGARANGE %s +// RUN: %clang -### %s -g -target x86_64-scei-ps5 2>&1 \ +// RUN: | FileCheck -check-prefix=LDGARANGE %s // On the AIX, -g defaults to -gdbx and limited debug info. // RUN: %clang -### -c -g %s -target powerpc-ibm-aix-xcoff 2>&1 \ @@ -365,6 +373,13 @@ // NOPUB-NOT: -ggnu-pubnames // NOPUB-NOT: -gpubnames // + +// LDGARANGE: {{".*ld.*"}} {{.*}} +// LDGARANGE-NOT: "-generate-arange-section" +// LLDGARANGE: {{".*lld.*"}} {{.*}} "-generate-arange-section" +// SNLDTLTOGARANGE: {{".*orbis-ld.*"}} {{.*}} "-lto-thin-debug-options=-generate-arange-section" +// SNLDFLTOGARANGE: {{".*orbis-ld.*"}} {{.*}} "-lto-debug-options=-generate-arange-section" + // PUB: -gpubnames // // RNGBSE: -fdebug-ranges-base-address diff --git a/clang/test/Driver/ps4-ps5-linker-jmc.c b/clang/test/Driver/ps4-ps5-linker-jmc.c index 3d308d13e64f..f5accd14291c 100644 --- a/clang/test/Driver/ps4-ps5-linker-jmc.c +++ b/clang/test/Driver/ps4-ps5-linker-jmc.c @@ -6,10 +6,10 @@ // RUN: %clang --target=x86_64-scei-ps5 -fjmc %s -### 2>&1 | FileCheck --check-prefixes=CHECK-PS5,CHECK-PS5-LIB %s // RUN: %clang --target=x86_64-scei-ps5 -flto -fjmc %s -### 2>&1 | FileCheck --check-prefixes=CHECK-PS5-LTO,CHECK-PS5-LIB %s -// CHECK-PS4-NOT: "-enable-jmc-instrument" +// CHECK-PS4-NOT: -enable-jmc-instrument -// CHECK-PS4-THIN-LTO: "-lto-thin-debug-options=-enable-jmc-instrument" -// CHECK-PS4-FULL-LTO:
[clang] 9ce0909 - Revert "[CUDA][SPIRV] Assign global address space to CUDA kernel arguments"
Author: Matthew Voss Date: 2022-02-17T14:32:10-08:00 New Revision: 9ce09099bba4be68d2a269b0bfd2b1dcc67f02d4 URL: https://github.com/llvm/llvm-project/commit/9ce09099bba4be68d2a269b0bfd2b1dcc67f02d4 DIFF: https://github.com/llvm/llvm-project/commit/9ce09099bba4be68d2a269b0bfd2b1dcc67f02d4.diff LOG: Revert "[CUDA][SPIRV] Assign global address space to CUDA kernel arguments" This reverts commit 9de4fc0f2d3b60542956f7e5254951d049edeb1f. Reverting due to test failure: https://lab.llvm.org/buildbot/#/builders/139/builds/17199 Added: Modified: clang/lib/Basic/Targets/SPIR.h clang/lib/CodeGen/TargetInfo.cpp Removed: clang/test/CodeGenCUDASPIRV/kernel-argument.cu diff --git a/clang/lib/Basic/Targets/SPIR.h b/clang/lib/Basic/Targets/SPIR.h index 08c49f018ac79..a40d4b3ca27e1 100644 --- a/clang/lib/Basic/Targets/SPIR.h +++ b/clang/lib/Basic/Targets/SPIR.h @@ -144,16 +144,16 @@ class LLVM_LIBRARY_VISIBILITY BaseSPIRTargetInfo : public TargetInfo { // FIXME: SYCL specification considers unannotated pointers and references // to be pointing to the generic address space. See section 5.9.3 of // SYCL 2020 specification. -// Currently, there is no way of representing SYCL's and HIP/CUDA's default +// Currently, there is no way of representing SYCL's and HIP's default // address space language semantic along with the semantics of embedded C's // default address space in the same address space map. Hence the map needs // to be reset to allow mapping to the desired value of 'Default' entry for -// SYCL and HIP/CUDA. +// SYCL and HIP. setAddressSpaceMap( /*DefaultIsGeneric=*/Opts.SYCLIsDevice || -// The address mapping from HIP/CUDA language for device code is only -// defined for SPIR-V. -(getTriple().isSPIRV() && Opts.CUDAIsDevice)); +// The address mapping from HIP language for device code is only defined +// for SPIR-V. +(getTriple().isSPIRV() && Opts.HIP && Opts.CUDAIsDevice)); } void setSupportedOpenCLOpts() override { diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 5a2991dfe1762..3e1df744b2ad7 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -10320,10 +10320,10 @@ void CommonSPIRABIInfo::setCCs() { } ABIArgInfo SPIRVABIInfo::classifyKernelArgumentType(QualType Ty) const { - if (getContext().getLangOpts().CUDAIsDevice) { + if (getContext().getLangOpts().HIP) { // Coerce pointer arguments with default address space to CrossWorkGroup -// pointers for HIPSPV/CUDASPV. When the language mode is HIP/CUDA, the -// SPIRTargetInfo maps cuda_device to SPIR-V's CrossWorkGroup address space. +// pointers for HIPSPV. When the language mode is HIP, the SPIRTargetInfo +// maps cuda_device to SPIR-V's CrossWorkGroup address space. llvm::Type *LTy = CGT.ConvertType(Ty); auto DefaultAS = getContext().getTargetAddressSpace(LangAS::Default); auto GlobalAS = getContext().getTargetAddressSpace(LangAS::cuda_device); diff --git a/clang/test/CodeGenCUDASPIRV/kernel-argument.cu b/clang/test/CodeGenCUDASPIRV/kernel-argument.cu deleted file mode 100644 index 0ccacffd12a5f..0 --- a/clang/test/CodeGenCUDASPIRV/kernel-argument.cu +++ /dev/null @@ -1,17 +0,0 @@ -// Tests CUDA kernel arguments get global address space when targetting SPIR-V. - -// REQUIRES: clang-driver - -// RUN: %clang -emit-llvm --cuda-device-only --offload=spirv32 \ -// RUN: -nocudalib -nocudainc %s -o %t.bc -c 2>&1 -// RUN: llvm-dis %t.bc -o %t.ll -// RUN: FileCheck %s --input-file=%t.ll - -// RUN: %clang -emit-llvm --cuda-device-only --offload=spirv64 \ -// RUN: -nocudalib -nocudainc %s -o %t.bc -c 2>&1 -// RUN: llvm-dis %t.bc -o %t.ll -// RUN: FileCheck %s --input-file=%t.ll - -// CHECK: define spir_kernel void @_Z6kernelPi(i32 addrspace(1)* noundef %output.coerce) - -__attribute__((global)) void kernel(int* output) { *output = 1; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 003fed8 - [test] Fix test failure in Clang :: Lexer/char-escapes-delimited.c
Author: Matthew Voss Date: 2021-09-16T09:20:05-07:00 New Revision: 003fed8269b3f6d2b1618b670fc73d28972999e4 URL: https://github.com/llvm/llvm-project/commit/003fed8269b3f6d2b1618b670fc73d28972999e4 DIFF: https://github.com/llvm/llvm-project/commit/003fed8269b3f6d2b1618b670fc73d28972999e4.diff LOG: [test] Fix test failure in Clang :: Lexer/char-escapes-delimited.c Specify the C and C++ standards explicitly for this test. This avoids failures for drivers that default to older standards. Differential Revision: https://reviews.llvm.org/D109857 Added: Modified: clang/test/Lexer/char-escapes-delimited.c Removed: diff --git a/clang/test/Lexer/char-escapes-delimited.c b/clang/test/Lexer/char-escapes-delimited.c index ad413d1843b06..62465db464bce 100644 --- a/clang/test/Lexer/char-escapes-delimited.c +++ b/clang/test/Lexer/char-escapes-delimited.c @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s -// RUN: %clang_cc1 -x c -fsyntax-only -pedantic -verify %s -// RUN: %clang_cc1 -fwchar-type=short -fno-signed-wchar -fsyntax-only -pedantic -verify %s -// RUN: %clang_cc1 -x c -fwchar-type=short -fno-signed-wchar -fsyntax-only -pedantic -verify %s +// RUN: %clang_cc1 -x c++ -std=gnu++11 -fsyntax-only -pedantic -verify %s +// RUN: %clang_cc1 -x c -std=gnu11 -fsyntax-only -pedantic -verify %s +// RUN: %clang_cc1 -x c++ -std=gnu++11 -fwchar-type=short -fno-signed-wchar -fsyntax-only -pedantic -verify %s +// RUN: %clang_cc1 -x c -std=gnu11 -fwchar-type=short -fno-signed-wchar -fsyntax-only -pedantic -verify %s const char *errors = "\u{}" //expected-error {{delimited escape sequence cannot be empty}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 0386f3d - [NFC] Specify C11 in loop-opt-setup.c
Author: Matthew Voss Date: 2021-01-08T12:15:26-08:00 New Revision: 0386f3d4f4183a93d7e029abef8110ae4f148335 URL: https://github.com/llvm/llvm-project/commit/0386f3d4f4183a93d7e029abef8110ae4f148335 DIFF: https://github.com/llvm/llvm-project/commit/0386f3d4f4183a93d7e029abef8110ae4f148335.diff LOG: [NFC] Specify C11 in loop-opt-setup.c This test was failing in our internal CI, since our driver does not default to C11. Adding this switch fixes the issue. Differential Revision: https://reviews.llvm.org/D94327 Added: Modified: clang/test/Misc/loop-opt-setup.c Removed: diff --git a/clang/test/Misc/loop-opt-setup.c b/clang/test/Misc/loop-opt-setup.c index e9a9c1e8ae2d..63a6972b82a0 100644 --- a/clang/test/Misc/loop-opt-setup.c +++ b/clang/test/Misc/loop-opt-setup.c @@ -1,5 +1,5 @@ // This tests loop unrolling and loop deletion (enabled under -O1) -// RUN: %clang_cc1 -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s +// RUN: %clang_cc1 -std=c11 -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s // RUN: %clang_cc1 -std=c99 -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s --check-prefix C99 extern int a[16]; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r365678 - Revert "[clangd] Filter out non-governed files from broadcast"
Author: ormris Date: Wed Jul 10 11:16:35 2019 New Revision: 365678 URL: http://llvm.org/viewvc/llvm-project?rev=365678=rev Log: Revert "[clangd] Filter out non-governed files from broadcast" This reverts commit d5214dfa7b5650745eaeb102857c9e90adb16137. It's causing failures, both in our local CI and the PS4 Windows bot. http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/26872/steps/test/logs/stdio Modified: clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.cpp clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.h clang-tools-extra/trunk/clangd/QueryDriverDatabase.cpp clang-tools-extra/trunk/clangd/index/Background.cpp clang-tools-extra/trunk/clangd/unittests/ClangdTests.cpp clang-tools-extra/trunk/clangd/unittests/GlobalCompilationDatabaseTests.cpp clang-tools-extra/trunk/clangd/unittests/TestFS.cpp clang-tools-extra/trunk/clangd/unittests/TestFS.h Modified: clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.cpp?rev=365678=365677=365678=diff == --- clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.cpp (original) +++ clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.cpp Wed Jul 10 11:16:35 2019 @@ -8,18 +8,12 @@ #include "GlobalCompilationDatabase.h" #include "Logger.h" -#include "Path.h" #include "clang/Frontend/CompilerInvocation.h" #include "clang/Tooling/ArgumentsAdjusters.h" #include "clang/Tooling/CompilationDatabase.h" -#include "llvm/ADT/None.h" #include "llvm/ADT/Optional.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" -#include -#include -#include namespace clang { namespace clangd { @@ -49,16 +43,6 @@ std::string getStandardResourceDir() { return CompilerInvocation::GetResourcesPath("clangd", (void *)); } -// Runs the given action on all parent directories of filename, starting from -// deepest directory and going up to root. Stops whenever action succeeds. -void actOnAllParentDirectories(PathRef FileName, - llvm::function_ref Action) { - for (auto Path = llvm::sys::path::parent_path(FileName); - !Path.empty() && !Action(Path); - Path = llvm::sys::path::parent_path(Path)) -; -} - } // namespace static std::string getFallbackClangPath() { @@ -97,138 +81,60 @@ DirectoryBasedGlobalCompilationDatabase: ~DirectoryBasedGlobalCompilationDatabase() = default; llvm::Optional -DirectoryBasedGlobalCompilationDatabase::getCompileCommand(PathRef File) const { - CDBLookupRequest Req; - Req.FileName = File; - Req.ShouldBroadcast = true; - - auto Res = lookupCDB(Req); - if (!Res) { +DirectoryBasedGlobalCompilationDatabase::getCompileCommand( +PathRef File, ProjectInfo *Project) const { + if (auto CDB = getCDBForFile(File, Project)) { +auto Candidates = CDB->getCompileCommands(File); +if (!Candidates.empty()) { + return std::move(Candidates.front()); +} + } else { log("Failed to find compilation database for {0}", File); -return llvm::None; } - - auto Candidates = Res->CDB->getCompileCommands(File); - if (!Candidates.empty()) -return std::move(Candidates.front()); - return None; } -std::pair +std::pair DirectoryBasedGlobalCompilationDatabase::getCDBInDirLocked(PathRef Dir) const { // FIXME(ibiryukov): Invalidate cached compilation databases on changes auto CachedIt = CompilationDatabases.find(Dir); if (CachedIt != CompilationDatabases.end()) -return {CachedIt->second.CDB.get(), CachedIt->second.SentBroadcast}; +return {CachedIt->second.get(), true}; std::string Error = ""; - - CachedCDB Entry; - Entry.CDB = tooling::CompilationDatabase::loadFromDirectory(Dir, Error); - auto Result = Entry.CDB.get(); - CompilationDatabases[Dir] = std::move(Entry); - + auto CDB = tooling::CompilationDatabase::loadFromDirectory(Dir, Error); + auto Result = CDB.get(); + CompilationDatabases.insert(std::make_pair(Dir, std::move(CDB))); return {Result, false}; } -llvm::Optional -DirectoryBasedGlobalCompilationDatabase::lookupCDB( -CDBLookupRequest Request) const { - assert(llvm::sys::path::is_absolute(Request.FileName) && +tooling::CompilationDatabase * +DirectoryBasedGlobalCompilationDatabase::getCDBForFile( +PathRef File, ProjectInfo *Project) const { + namespace path = llvm::sys::path; + assert((path::is_absolute(File, path::Style::posix) || + path::is_absolute(File, path::Style::windows)) && "path must be absolute"); - CDBLookupResult Result; - bool SentBroadcast = false; - - { -std::lock_guard Lock(Mutex); -if (CompileCommandsDir) { - std::tie(Result.CDB, SentBroadcast) = - getCDBInDirLocked(*CompileCommandsDir); - Result.PI.SourceRoot = *CompileCommandsDir; -}
[libunwind] r355725 - Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"
Author: ormris Date: Fri Mar 8 12:33:55 2019 New Revision: 355725 URL: http://llvm.org/viewvc/llvm-project?rev=355725=rev Log: Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/" This broke the windows bots. This reverts commit 28302c66d2586074f77497d5dc4eac7182b679e0. Modified: libunwind/trunk/CMakeLists.txt libunwind/trunk/src/CMakeLists.txt Modified: libunwind/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=355725=355724=355725=diff == --- libunwind/trunk/CMakeLists.txt (original) +++ libunwind/trunk/CMakeLists.txt Fri Mar 8 12:33:55 2019 @@ -187,25 +187,20 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[ ${PACKAGE_VERSION}) if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) - set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}${LIBUNWIND_LIBDIR_SUBDIR}) - set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}) - if(LIBCXX_LIBDIR_SUBDIR) -string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR}) -string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR}) - endif() + set(DEFAULT_INSTALL_PREFIX lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/) + set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/lib${LIBUNWIND_LIBDIR_SUFFIX}) elseif(LLVM_LIBRARY_OUTPUT_INTDIR) set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) - set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX}) else() set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX}) - set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX}) endif() set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR}) -set(LIBUNWIND_INSTALL_PREFIX "" CACHE STRING "Define libunwind destination prefix.") +set(LIBUNWIND_INSTALL_PREFIX ${DEFAULT_INSTALL_PREFIX} CACHE STRING +"Define libunwind destination prefix.") set(LIBUNWIND_C_FLAGS "") set(LIBUNWIND_CXX_FLAGS "") Modified: libunwind/trunk/src/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=355725=355724=355725=diff == --- libunwind/trunk/src/CMakeLists.txt (original) +++ libunwind/trunk/src/CMakeLists.txt Fri Mar 8 12:33:55 2019 @@ -178,8 +178,8 @@ add_custom_target(unwind DEPENDS ${LIBUN if (LIBUNWIND_INSTALL_LIBRARY) install(TARGETS ${LIBUNWIND_INSTALL_TARGETS} -LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}${LIBUNWIND_INSTALL_LIBRARY_DIR} COMPONENT unwind -ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}${LIBUNWIND_INSTALL_LIBRARY_DIR} COMPONENT unwind) +LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind +ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind) endif() if (NOT CMAKE_CONFIGURATION_TYPES AND LIBUNWIND_INSTALL_LIBRARY) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r355725 - Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"
Author: ormris Date: Fri Mar 8 12:33:55 2019 New Revision: 355725 URL: http://llvm.org/viewvc/llvm-project?rev=355725=rev Log: Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/" This broke the windows bots. This reverts commit 28302c66d2586074f77497d5dc4eac7182b679e0. Modified: cfe/trunk/lib/Driver/ToolChain.cpp cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp cfe/trunk/lib/Driver/ToolChains/Linux.cpp cfe/trunk/test/Driver/linux-per-target-runtime-dir.c Modified: cfe/trunk/lib/Driver/ToolChain.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=355725=355724=355725=diff == --- cfe/trunk/lib/Driver/ToolChain.cpp (original) +++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Mar 8 12:33:55 2019 @@ -75,11 +75,6 @@ ToolChain::ToolChain(const Driver , co CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)) { SmallString<128> P; - P.assign(D.Dir); - llvm::sys::path::append(P, "..", "lib", D.getTargetTriple()); - if (getVFS().exists(P)) -getLibraryPaths().push_back(P.str()); - P.assign(D.ResourceDir); llvm::sys::path::append(P, D.getTargetTriple(), "lib"); if (getVFS().exists(P)) Modified: cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp?rev=355725=355724=355725=diff == --- cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp Fri Mar 8 12:33:55 2019 @@ -257,8 +257,8 @@ void Fuchsia::AddClangCXXStdlibIncludeAr switch (GetCXXStdlibType(DriverArgs)) { case ToolChain::CST_Libcxx: { -SmallString<128> P(getDriver().Dir); -llvm::sys::path::append(P, "..", "include", "c++", "v1"); +SmallString<128> P(getDriver().ResourceDir); +llvm::sys::path::append(P, "include", "c++", "v1"); addSystemInclude(DriverArgs, CC1Args, P.str()); break; } Modified: cfe/trunk/lib/Driver/ToolChains/Linux.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Linux.cpp?rev=355725=355724=355725=diff == --- cfe/trunk/lib/Driver/ToolChains/Linux.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp Fri Mar 8 12:33:55 2019 @@ -880,6 +880,7 @@ void Linux::addLibCxxIncludePaths(const llvm::opt::ArgStringList ) const { const std::string& SysRoot = computeSysRoot(); const std::string LibCXXIncludePathCandidates[] = { + DetectLibcxxIncludePath(getDriver().ResourceDir + "/include/c++"), DetectLibcxxIncludePath(getDriver().Dir + "/../include/c++"), // If this is a development, non-installed, clang, libcxx will // not be found at ../include/c++ but it likely to be found at Modified: cfe/trunk/test/Driver/linux-per-target-runtime-dir.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-per-target-runtime-dir.c?rev=355725=355724=355725=diff == --- cfe/trunk/test/Driver/linux-per-target-runtime-dir.c (original) +++ cfe/trunk/test/Driver/linux-per-target-runtime-dir.c Fri Mar 8 12:33:55 2019 @@ -6,14 +6,12 @@ // RUN: --gcc-toolchain="" \ // RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree \ // RUN: | FileCheck --check-prefix=CHECK-PER-TARGET-RUNTIME %s -// CHECK-PER-TARGET-RUNTIME: InstalledDir: [[INSTDIR:.*]] // CHECK-PER-TARGET-RUNTIME: "{{[^"]*}}clang{{[^"]*}}" "-cc1" // CHECK-PER-TARGET-RUNTIME: "-resource-dir" "[[RESDIR:[^"]*]]" // CHECK-PER-TARGET-RUNTIME: "-isysroot" "[[SYSROOT:[^"]+]]" -// CHECK-PER-TARGET-RUNTIME: "-internal-isystem" "[[INSTDIR]]/../include/c++/v1" +// CHECK-PER-TARGET-RUNTIME: "-internal-isystem" "[[RESDIR]]/include/c++/v1" // CHECK-PER-TARGET-RUNTIME: "-internal-isystem" "[[SYSROOT]]/usr/local/include" // CHECK-PER-TARGET-RUNTIME: "--sysroot=[[SYSROOT]]" -// CHECK-PER-TARGET-RUNTIME: "-L[[INSTDIR]]{{/|}}..{{/|}}lib{{/|}}x86_64-linux-gnu" // CHECK-PER-TARGET-RUNTIME: "-L[[RESDIR]]{{/|}}x86_64-linux-gnu{{/|}}lib" // RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r348028 - Expect mixed path separators in FileManagerTest when resolving paths on Win32
Author: ormris Date: Fri Nov 30 11:52:50 2018 New Revision: 348028 URL: http://llvm.org/viewvc/llvm-project?rev=348028=rev Log: Expect mixed path separators in FileManagerTest when resolving paths on Win32 Modified: cfe/trunk/unittests/Basic/FileManagerTest.cpp Modified: cfe/trunk/unittests/Basic/FileManagerTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/FileManagerTest.cpp?rev=348028=348027=348028=diff == --- cfe/trunk/unittests/Basic/FileManagerTest.cpp (original) +++ cfe/trunk/unittests/Basic/FileManagerTest.cpp Fri Nov 30 11:52:50 2018 @@ -363,7 +363,7 @@ TEST_F(FileManagerTest, getVirtualFileFi ASSERT_TRUE(file->isValid()); SmallString<64> ExpectedResult; #ifdef _WIN32 - ExpectedResult = "C:"; + ExpectedResult = "C:/"; #else ExpectedResult = "/"; #endif ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r347815 - Ensure that test clang-tidy/export-relpath.cpp works with Windows path separators.
Author: ormris Date: Wed Nov 28 14:16:18 2018 New Revision: 347815 URL: http://llvm.org/viewvc/llvm-project?rev=347815=rev Log: Ensure that test clang-tidy/export-relpath.cpp works with Windows path separators. Modified: clang-tools-extra/trunk/test/clang-tidy/export-relpath.cpp Modified: clang-tools-extra/trunk/test/clang-tidy/export-relpath.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/export-relpath.cpp?rev=347815=347814=347815=diff == --- clang-tools-extra/trunk/test/clang-tidy/export-relpath.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/export-relpath.cpp Wed Nov 28 14:16:18 2018 @@ -1,7 +1,7 @@ // RUN: rm -rf %T/clang-tidy/export-relpath // RUN: mkdir -p %T/clang-tidy/export-relpath/subdir // RUN: cp %s %T/clang-tidy/export-relpath/subdir/source.cpp -// RUN: echo '[{ "directory": "%T/clang-tidy/export-relpath/subdir", "command": "clang++ source.cpp", "file": "%T/clang-tidy/export-relpath/subdir/source.cpp"}]' > %T/clang-tidy/export-relpath/subdir/compile_commands.json +// RUN: echo '[{ "directory": "%/T/clang-tidy/export-relpath/subdir", "command": "clang++ source.cpp", "file": "%/T/clang-tidy/export-relpath/subdir/source.cpp"}]' > %T/clang-tidy/export-relpath/subdir/compile_commands.json // // Check that running clang-tidy in './subdir' and storing results // in './fixes.yaml' works as expected. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r347792 - Revert "[clang-tools-extra] r347753 - [clangd] Build and test IndexBenchmark in check-clangd"
Author: ormris Date: Wed Nov 28 10:48:32 2018 New Revision: 347792 URL: http://llvm.org/viewvc/llvm-project?rev=347792=rev Log: Revert "[clang-tools-extra] r347753 - [clangd] Build and test IndexBenchmark in check-clangd" This revision was causing failures on the buildbots, and our internal CI. See: http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/20856 Modified: clang-tools-extra/trunk/test/CMakeLists.txt clang-tools-extra/trunk/test/clangd/Inputs/requests.json clang-tools-extra/trunk/test/clangd/index-tools.test Modified: clang-tools-extra/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/CMakeLists.txt?rev=347792=347791=347792=diff == --- clang-tools-extra/trunk/test/CMakeLists.txt (original) +++ clang-tools-extra/trunk/test/CMakeLists.txt Wed Nov 28 10:48:32 2018 @@ -72,10 +72,6 @@ set(CLANGD_TEST_DEPS dexp ) -if (LLVM_INCLUDE_BENCHMARKS) - list(APPEND CLANGD_TEST_DEPS IndexBenchmark) -endif() - # Add lit test dependencies. set(LLVM_UTILS_DEPS FileCheck count not Modified: clang-tools-extra/trunk/test/clangd/Inputs/requests.json URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clangd/Inputs/requests.json?rev=347792=347791=347792=diff == --- clang-tools-extra/trunk/test/clangd/Inputs/requests.json (original) +++ clang-tools-extra/trunk/test/clangd/Inputs/requests.json Wed Nov 28 10:48:32 2018 @@ -1,7 +1,7 @@ -[{"Limit":100,"ProximityPaths":["/usr/home/user/clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp"],"Query":"OMP","RestrictForCodeCompletion":true,"Scopes":["clang::"], "AnyScope":false}, -{"Limit":100,"ProximityPaths":[],"Query":"s","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""], "AnyScope":false}, -{"Limit":100,"ProximityPaths":[],"Query":"sy","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""], "AnyScope":false}, -{"Limit":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""], "AnyScope":false}, -{"Limit":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""], "AnyScope":false}, -{"Limit":100,"ProximityPaths":[],"Query":"Dex","RestrictForCodeCompletion":true,"Scopes":["clang::clangd::", "clang::", "clang::clangd::dex::"],"AnyScope":false}, -{"Limit":100,"ProximityPaths":[],"Query":"Variable","RestrictForCodeCompletion":true,"Scopes":[""], "AnyScope":false}] +[{"Limit":100,"ProximityPaths":["/usr/home/user/clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp"],"Query":"OMP","RestrictForCodeCompletion":true,"Scopes":["clang::"]}, +{"Limit":100,"ProximityPaths":[],"Query":"s","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""]}, +{"Limit":100,"ProximityPaths":[],"Query":"sy","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""]}, +{"Limit":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""]}, +{"Limit":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""]}, +{"Limit":100,"ProximityPaths":[],"Query":"Dex","RestrictForCodeCompletion":true,"Scopes":["clang::clangd::", "clang::", "clang::clangd::dex::"]}, +{"Limit":100,"ProximityPaths":[],"Query":"Variable","RestrictForCodeCompletion":true,"Scopes":[""]}] Modified: clang-tools-extra/trunk/test/clangd/index-tools.test URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clangd/index-tools.test?rev=347792=347791=347792=diff == --- clang-tools-extra/trunk/test/clangd/index-tools.test (original) +++ clang-tools-extra/trunk/test/clangd/index-tools.test Wed Nov 28 10:48:32 2018 @@ -1,4 +1,5 @@ # RUN: clangd-indexer %p/Inputs/BenchmarkSource.cpp -- -I%p/Inputs > %t.index +# FIXME: By default, benchmarks are excluded from the list of default targets hence not built. Find a way to depend on benchmarks to run the next command. # REQUIRES: shell # RUN: if [ -f %clangd-benchmark-dir/IndexBenchmark ]; then %clangd-benchmark-dir/IndexBenchmark %t.index %p/Inputs/requests.json --benchmark_min_time=0.01 ; fi # Pass invalid JSON file and check that IndexBenchmark fails to parse it. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r347284 - Ensure FileManagerTest expects "\\" as path separator on Windows platforms
Author: ormris Date: Mon Nov 19 19:30:28 2018 New Revision: 347284 URL: http://llvm.org/viewvc/llvm-project?rev=347284=rev Log: Ensure FileManagerTest expects "\\" as path separator on Windows platforms Modified: cfe/trunk/unittests/Basic/FileManagerTest.cpp Modified: cfe/trunk/unittests/Basic/FileManagerTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/FileManagerTest.cpp?rev=347284=347283=347284=diff == --- cfe/trunk/unittests/Basic/FileManagerTest.cpp (original) +++ cfe/trunk/unittests/Basic/FileManagerTest.cpp Mon Nov 19 19:30:28 2018 @@ -240,7 +240,11 @@ TEST_F(FileManagerTest, getFileDefersOpe file = manager.getFile("/tmp/test", /*OpenFile=*/true); ASSERT_TRUE(file != nullptr); ASSERT_TRUE(file->isValid()); +#ifdef _WIN32 + EXPECT_EQ("/tmp\\test", file->tryGetRealPathName()); +#else EXPECT_EQ("/tmp/test", file->tryGetRealPathName()); +#endif // However we should never try to open a file previously opened as virtual. ASSERT_TRUE(manager.getVirtualFile("/tmp/testv", 5, 0)); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r343707 - Add template type and value parameter metadata nodes to template variable specializations
Author: ormris Date: Wed Oct 3 11:45:04 2018 New Revision: 343707 URL: http://llvm.org/viewvc/llvm-project?rev=343707=rev Log: Add template type and value parameter metadata nodes to template variable specializations Summary: Add an optional attribute referring to a tuple of type and value template parameter nodes to the DIGlobalVariable node. This allows us to record the parameters of template variable specializations. Reviewers: dblaikie, aprantl, probinson, JDevlieghere, clayborg, jingham Reviewed By: JDevlieghere Subscribers: cfe-commits Tags: #debug-info Differential Revision: https://reviews.llvm.org/D52058 Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.h cfe/trunk/test/CodeGenCXX/debug-info-template-member.cpp Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=343707=343706=343707=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Oct 3 11:45:04 2018 @@ -41,6 +41,7 @@ #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Intrinsics.h" +#include "llvm/IR/Metadata.h" #include "llvm/IR/Module.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/MD5.h" @@ -1776,6 +1777,29 @@ CGDebugInfo::CollectFunctionTemplatePara return llvm::DINodeArray(); } +llvm::DINodeArray CGDebugInfo::CollectVarTemplateParams(const VarDecl *VL, +llvm::DIFile *Unit) { + if (auto *TS = dyn_cast(VL)) { +auto T = TS->getSpecializedTemplateOrPartial(); +auto TA = TS->getTemplateArgs().asArray(); +// Collect parameters for a partial specialization +if (T.is()) { + const TemplateParameterList *TList = +T.get() +->getTemplateParameters(); + return CollectTemplateParams(TList, TA, Unit); +} + +// Collect parameters for an explicit specialization +if (T.is()) { + const TemplateParameterList *TList = T.get() +->getTemplateParameters(); + return CollectTemplateParams(TList, TA, Unit); +} + } + return llvm::DINodeArray(); +} + llvm::DINodeArray CGDebugInfo::CollectCXXTemplateParams( const ClassTemplateSpecializationDecl *TSpecial, llvm::DIFile *Unit) { // Always get the full list of parameters, not just the ones from @@ -3070,6 +3094,7 @@ void CGDebugInfo::collectFunctionDeclPro void CGDebugInfo::collectVarDeclProps(const VarDecl *VD, llvm::DIFile *, unsigned , QualType , StringRef , StringRef , + llvm::MDTuple *, llvm::DIScope *) { Unit = getOrCreateFile(VD->getLocation()); LineNo = getLineNumber(VD->getLocation()); @@ -3093,6 +3118,13 @@ void CGDebugInfo::collectVarDeclProps(co if (LinkageName == Name) LinkageName = StringRef(); + if (isa(VD)) { +llvm::DINodeArray parameterNodes = CollectVarTemplateParams(VD, &*Unit); +TemplateParameters = parameterNodes.get(); + } else { +TemplateParameters = nullptr; + } + // Since we emit declarations (DW_AT_members) for static members, place the // definition of those static members in the namespace they were declared in // in the source code (the lexical decl context). @@ -3173,12 +3205,14 @@ CGDebugInfo::getGlobalVariableForwardDec llvm::DIFile *Unit = getOrCreateFile(Loc); llvm::DIScope *DContext = Unit; unsigned Line = getLineNumber(Loc); + llvm::MDTuple *TemplateParameters = nullptr; - collectVarDeclProps(VD, Unit, Line, T, Name, LinkageName, DContext); + collectVarDeclProps(VD, Unit, Line, T, Name, LinkageName, TemplateParameters, + DContext); auto Align = getDeclAlignIfRequired(VD, CGM.getContext()); auto *GV = DBuilder.createTempGlobalVariableFwdDecl( DContext, Name, LinkageName, Unit, Line, getOrCreateType(T, Unit), - !VD->isExternallyVisible(), nullptr, Align); + !VD->isExternallyVisible(), nullptr, TemplateParameters, Align); FwdDeclReplaceMap.emplace_back( std::piecewise_construct, std::make_tuple(cast(VD->getCanonicalDecl())), @@ -4089,7 +4123,9 @@ void CGDebugInfo::EmitGlobalVariable(llv unsigned LineNo; StringRef DeclName, LinkageName; QualType T; - collectVarDeclProps(D, Unit, LineNo, T, DeclName, LinkageName, DContext); + llvm::MDTuple *TemplateParameters = nullptr; + collectVarDeclProps(D, Unit, LineNo, T, DeclName, LinkageName, + TemplateParameters, DContext); // Attempt to store one global variable for the declaration - even if we // emit a lot of fields. @@ -4115,7 +4151,8 @@ void CGDebugInfo::EmitGlobalVariable(llv DContext, DeclName, LinkageName, Unit, LineNo, getOrCreateType(T, Unit), Var->hasLocalLinkage(), Expr.empty() ? nullptr :
r334554 - [analyzer] Ensure that loop widening does not invalidate references
Author: ormris Date: Tue Jun 12 15:22:35 2018 New Revision: 334554 URL: http://llvm.org/viewvc/llvm-project?rev=334554=rev Log: [analyzer] Ensure that loop widening does not invalidate references Loop widening can invalidate a reference. If the analyzer attempts to visit the destructor to a non-existent reference, it will crash. This patch ensures that the reference is preserved. https://reviews.llvm.org/D47044 Added: cfe/trunk/test/Analysis/loop-widening-preserve-reference-type.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Core/LoopWidening.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Core/LoopWidening.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/LoopWidening.cpp?rev=334554=334553=334554=diff == --- cfe/trunk/lib/StaticAnalyzer/Core/LoopWidening.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/LoopWidening.cpp Tue Jun 12 15:22:35 2018 @@ -14,10 +14,16 @@ /// //===--===// +#include "clang/AST/AST.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h" #include "clang/StaticAnalyzer/Core/PathSensitive/LoopWidening.h" using namespace clang; using namespace ento; +using namespace clang::ast_matchers; + +const auto MatchRef = "matchref"; /// Return the loops condition Stmt or NULL if LoopStmt is not a loop static const Expr *getLoopCondition(const Stmt *LoopStmt) { @@ -49,6 +55,7 @@ ProgramStateRef getWidenedLoopState(Prog // TODO Nested loops are currently widened as a result of the invalidation // being so inprecise. When the invalidation is improved, the handling // of nested loops will also need to be improved. + ASTContext = LCtx->getAnalysisDeclContext()->getASTContext(); const StackFrameContext *STC = LCtx->getCurrentStackFrame(); MemRegionManager = PrevState->getStateManager().getRegionManager(); const MemRegion *Regions[] = {MRMgr.getStackLocalsRegion(STC), @@ -60,6 +67,18 @@ ProgramStateRef getWidenedLoopState(Prog RegionAndSymbolInvalidationTraits::TK_EntireMemSpace); } + // References should not be invalidated. + auto Matches = match(findAll(stmt(hasDescendant(varDecl(hasType(referenceType())).bind(MatchRef, + *LCtx->getDecl()->getBody(), ASTCtx); + for (BoundNodes Match : Matches) { +const VarDecl *VD = Match.getNodeAs(MatchRef); +assert(VD); +const VarRegion *VarMem = MRMgr.getVarRegion(VD, LCtx); +ITraits.setTrait(VarMem, + RegionAndSymbolInvalidationTraits::TK_PreserveContents); + } + + // 'this' pointer is not an lvalue, we should not invalidate it. If the loop // is located in a method, constructor or destructor, the value of 'this' // pointer shoule remain unchanged. Added: cfe/trunk/test/Analysis/loop-widening-preserve-reference-type.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/loop-widening-preserve-reference-type.cpp?rev=334554=auto == --- cfe/trunk/test/Analysis/loop-widening-preserve-reference-type.cpp (added) +++ cfe/trunk/test/Analysis/loop-widening-preserve-reference-type.cpp Tue Jun 12 15:22:35 2018 @@ -0,0 +1,14 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc,debug.ExprInspection -analyzer-max-loop 4 -analyzer-config widen-loops=true -verify %s + +void clang_analyzer_eval(int); + +struct A { + ~A() {} +}; +struct B : public A {}; + +void invalid_type_region_access() { + const A = B(); + for (int i = 0; i < 10; ++i) { } + clang_analyzer_eval( != 0); // expected-warning{{TRUE}} +} // expected-warning@-1{{reference cannot be bound to dereferenced null pointer in well-defined C++ code; comparison may be assumed to always evaluate to true}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r326942 - Correct the alignment for the PS4 target
Author: ormris Date: Wed Mar 7 12:48:16 2018 New Revision: 326942 URL: http://llvm.org/viewvc/llvm-project?rev=326942=rev Log: Correct the alignment for the PS4 target https://reviews.llvm.org/D44218 Modified: cfe/trunk/lib/Basic/Targets/OSTargets.h cfe/trunk/test/Preprocessor/init.c Modified: cfe/trunk/lib/Basic/Targets/OSTargets.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/OSTargets.h?rev=326942=326941=326942=diff == --- cfe/trunk/lib/Basic/Targets/OSTargets.h (original) +++ cfe/trunk/lib/Basic/Targets/OSTargets.h Wed Mar 7 12:48:16 2018 @@ -485,6 +485,7 @@ public: default: case llvm::Triple::x86_64: this->MCountName = ".mcount"; + this->NewAlign = 256; break; } } Modified: cfe/trunk/test/Preprocessor/init.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=326942=326941=326942=diff == --- cfe/trunk/test/Preprocessor/init.c (original) +++ cfe/trunk/test/Preprocessor/init.c Wed Mar 7 12:48:16 2018 @@ -8965,6 +8965,9 @@ // PS4:#define __x86_64__ 1 // PS4:#define unix 1 // +// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=x86_64-scei-ps4 < /dev/null | FileCheck -match-full-lines -check-prefix PS4-CXX %s +// PS4-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 32UL +// // RUN: %clang_cc1 -E -dM -triple=x86_64-pc-mingw32 < /dev/null | FileCheck -match-full-lines -check-prefix X86-64-DECLSPEC %s // RUN: %clang_cc1 -E -dM -fms-extensions -triple=x86_64-unknown-mingw32 < /dev/null | FileCheck -match-full-lines -check-prefix X86-64-DECLSPEC %s // X86-64-DECLSPEC: #define __declspec{{.*}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits