[clang] b6cc5dd - [libLTO] Set data-sections by default in libLTO.
Author: Quinn Pham Date: 2022-07-27T09:39:39-05:00 New Revision: b6cc5ddc94780074e2a027e5c217a254a1b61b05 URL: https://github.com/llvm/llvm-project/commit/b6cc5ddc94780074e2a027e5c217a254a1b61b05 DIFF: https://github.com/llvm/llvm-project/commit/b6cc5ddc94780074e2a027e5c217a254a1b61b05.diff LOG: [libLTO] Set data-sections by default in libLTO. This patch changes legacy LTO to set data-sections by default. The user can explicitly unset data-sections. The reason for this patch is to match the behaviour of lld and gold plugin. Both lld and gold plugin have data-sections on by default. This patch also fixes the forwarding of the clang options -fno-data-sections and -fno-function-sections to libLTO. Now, when -fno-data/function-sections are specified in clang, -data/function-sections=0 will be passed to libLTO to explicitly unset data/function-sections. Reviewed By: w2yehia, MaskRay Differential Revision: https://reviews.llvm.org/D129401 Added: llvm/test/LTO/PowerPC/data-sections-aix.ll llvm/test/LTO/PowerPC/data-sections-linux.ll llvm/test/LTO/PowerPC/lit.local.cfg Modified: clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/function-sections.c llvm/lib/LTO/LTOCodeGenerator.cpp Removed: clang/test/Driver/gold-lto-sections.c diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 1d2c085d683e1..05afa712a809c 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -567,14 +567,16 @@ void tools::addLTOOptions(const ToolChain , const ArgList , isUseSeparateSections(ToolChain.getEffectiveTriple()); if (Args.hasFlag(options::OPT_ffunction_sections, - options::OPT_fno_function_sections, UseSeparateSections)) { -CmdArgs.push_back("-plugin-opt=-function-sections"); - } + options::OPT_fno_function_sections, UseSeparateSections)) +CmdArgs.push_back("-plugin-opt=-function-sections=1"); + else if (Args.hasArg(options::OPT_fno_function_sections)) +CmdArgs.push_back("-plugin-opt=-function-sections=0"); if (Args.hasFlag(options::OPT_fdata_sections, options::OPT_fno_data_sections, - UseSeparateSections)) { -CmdArgs.push_back("-plugin-opt=-data-sections"); - } + UseSeparateSections)) +CmdArgs.push_back("-plugin-opt=-data-sections=1"); + else if (Args.hasArg(options::OPT_fno_data_sections)) +CmdArgs.push_back("-plugin-opt=-data-sections=0"); // Pass an option to enable split machine functions. if (auto *A = Args.getLastArg(options::OPT_fsplit_machine_functions, diff --git a/clang/test/Driver/function-sections.c b/clang/test/Driver/function-sections.c index bfb6cc6920bd4..4d206ad150291 100644 --- a/clang/test/Driver/function-sections.c +++ b/clang/test/Driver/function-sections.c @@ -6,6 +6,12 @@ // CHECK-NODS-NOT: -fdata-sections // CHECK-US-NOT: -fno-unique-section-names // CHECK-NOUS: -fno-unique-section-names +// CHECK-PLUGIN-DEFAULT-NOT: "-plugin-opt=-function-sections +// CHECK-PLUGIN-DEFAULT-NOT: "-plugin-opt=-data-sections +// CHECK-PLUGIN-SECTIONS: "-plugin-opt=-function-sections=1" +// CHECK-PLUGIN-SECTIONS: "-plugin-opt=-data-sections=1" +// CHECK-PLUGIN-NO-SECTIONS: "-plugin-opt=-function-sections=0" +// CHECK-PLUGIN-NO-SECTIONS: "-plugin-opt=-data-sections=0" // RUN: %clang -### %s -fsyntax-only 2>&1 \ // RUN: --target=i386-unknown-linux \ @@ -72,3 +78,18 @@ // RUN: --target=i386-unknown-linux \ // RUN: -fno-unique-section-names \ // RUN: | FileCheck --check-prefix=CHECK-NOUS %s + + +// RUN: %clang -### %s -flto 2>&1\ +// RUN: --target=x86_64-unknown-linux \ +// RUN: | FileCheck --check-prefix=CHECK-PLUGIN-DEFAULT %s + +// RUN: %clang -### %s -flto 2>&1\ +// RUN: --target=x86_64-unknown-linux \ +// RUN: -ffunction-sections -fdata-sections \ +// RUN: | FileCheck --check-prefix=CHECK-PLUGIN-SECTIONS %s + +// RUN: %clang -### %s -flto 2>&1\ +// RUN: --target=x86_64-unknown-linux \ +// RUN: -fno-function-sections -fno-data-sections \ +// RUN: | FileCheck --check-prefix=CHECK-PLUGIN-NO-SECTIONS %s diff --git a/clang/test/Driver/gold-lto-sections.c b/clang/test/Driver/gold-lto-sections.c deleted file mode 100644 index 83d72cf7f97b8..0 --- a/clang/test/Driver/gold-lto-sections.c +++ /dev/null @@ -1,8 +0,0 @@ -// RUN: touch %t.o -// -// RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \ -// RUN: -Wl,-plugin-opt=foo -O3 \ -// RUN: -ffunction-sections -fdata-sections \ -// RUN: | FileCheck %s -// CHECK: "-plugin-opt=-function-sections" -// CHECK: "-plugin-opt=-data-sections" diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp index 2f7c485b9fc8f..8c374e0f2f858 100644 ---
[clang] 70ec8cd - Revert "[libLTO] Set data-sections by default in libLTO."
Author: Quinn Pham Date: 2022-07-27T08:47:00-05:00 New Revision: 70ec8cd024f3313962878bf68e89a0687c79ad05 URL: https://github.com/llvm/llvm-project/commit/70ec8cd024f3313962878bf68e89a0687c79ad05 DIFF: https://github.com/llvm/llvm-project/commit/70ec8cd024f3313962878bf68e89a0687c79ad05.diff LOG: Revert "[libLTO] Set data-sections by default in libLTO." This reverts commit f565444b486d49f84297c3a279ca24d785961ea8. Added: clang/test/Driver/gold-lto-sections.c Modified: clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/function-sections.c llvm/lib/LTO/LTOCodeGenerator.cpp Removed: llvm/test/LTO/PowerPC/data-sections-aix.ll llvm/test/LTO/PowerPC/data-sections-linux.ll diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 05afa712a809c..1d2c085d683e1 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -567,16 +567,14 @@ void tools::addLTOOptions(const ToolChain , const ArgList , isUseSeparateSections(ToolChain.getEffectiveTriple()); if (Args.hasFlag(options::OPT_ffunction_sections, - options::OPT_fno_function_sections, UseSeparateSections)) -CmdArgs.push_back("-plugin-opt=-function-sections=1"); - else if (Args.hasArg(options::OPT_fno_function_sections)) -CmdArgs.push_back("-plugin-opt=-function-sections=0"); + options::OPT_fno_function_sections, UseSeparateSections)) { +CmdArgs.push_back("-plugin-opt=-function-sections"); + } if (Args.hasFlag(options::OPT_fdata_sections, options::OPT_fno_data_sections, - UseSeparateSections)) -CmdArgs.push_back("-plugin-opt=-data-sections=1"); - else if (Args.hasArg(options::OPT_fno_data_sections)) -CmdArgs.push_back("-plugin-opt=-data-sections=0"); + UseSeparateSections)) { +CmdArgs.push_back("-plugin-opt=-data-sections"); + } // Pass an option to enable split machine functions. if (auto *A = Args.getLastArg(options::OPT_fsplit_machine_functions, diff --git a/clang/test/Driver/function-sections.c b/clang/test/Driver/function-sections.c index 4d206ad150291..bfb6cc6920bd4 100644 --- a/clang/test/Driver/function-sections.c +++ b/clang/test/Driver/function-sections.c @@ -6,12 +6,6 @@ // CHECK-NODS-NOT: -fdata-sections // CHECK-US-NOT: -fno-unique-section-names // CHECK-NOUS: -fno-unique-section-names -// CHECK-PLUGIN-DEFAULT-NOT: "-plugin-opt=-function-sections -// CHECK-PLUGIN-DEFAULT-NOT: "-plugin-opt=-data-sections -// CHECK-PLUGIN-SECTIONS: "-plugin-opt=-function-sections=1" -// CHECK-PLUGIN-SECTIONS: "-plugin-opt=-data-sections=1" -// CHECK-PLUGIN-NO-SECTIONS: "-plugin-opt=-function-sections=0" -// CHECK-PLUGIN-NO-SECTIONS: "-plugin-opt=-data-sections=0" // RUN: %clang -### %s -fsyntax-only 2>&1 \ // RUN: --target=i386-unknown-linux \ @@ -78,18 +72,3 @@ // RUN: --target=i386-unknown-linux \ // RUN: -fno-unique-section-names \ // RUN: | FileCheck --check-prefix=CHECK-NOUS %s - - -// RUN: %clang -### %s -flto 2>&1\ -// RUN: --target=x86_64-unknown-linux \ -// RUN: | FileCheck --check-prefix=CHECK-PLUGIN-DEFAULT %s - -// RUN: %clang -### %s -flto 2>&1\ -// RUN: --target=x86_64-unknown-linux \ -// RUN: -ffunction-sections -fdata-sections \ -// RUN: | FileCheck --check-prefix=CHECK-PLUGIN-SECTIONS %s - -// RUN: %clang -### %s -flto 2>&1\ -// RUN: --target=x86_64-unknown-linux \ -// RUN: -fno-function-sections -fno-data-sections \ -// RUN: | FileCheck --check-prefix=CHECK-PLUGIN-NO-SECTIONS %s diff --git a/clang/test/Driver/gold-lto-sections.c b/clang/test/Driver/gold-lto-sections.c new file mode 100644 index 0..83d72cf7f97b8 --- /dev/null +++ b/clang/test/Driver/gold-lto-sections.c @@ -0,0 +1,8 @@ +// RUN: touch %t.o +// +// RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \ +// RUN: -Wl,-plugin-opt=foo -O3 \ +// RUN: -ffunction-sections -fdata-sections \ +// RUN: | FileCheck %s +// CHECK: "-plugin-opt=-function-sections" +// CHECK: "-plugin-opt=-data-sections" diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp index 8c374e0f2f858..2f7c485b9fc8f 100644 --- a/llvm/lib/LTO/LTOCodeGenerator.cpp +++ b/llvm/lib/LTO/LTOCodeGenerator.cpp @@ -19,7 +19,6 @@ #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/Bitcode/BitcodeWriter.h" -#include "llvm/CodeGen/CommandFlags.h" #include "llvm/CodeGen/ParallelCG.h" #include "llvm/CodeGen/TargetSubtargetInfo.h" #include "llvm/Config/config.h" @@ -345,11 +344,6 @@ bool LTOCodeGenerator::determineTarget() { Config.CPU = "cyclone"; } - // If data-sections is not explicitly set or unset, set data-sections by - // default to match the
[clang] f565444 - [libLTO] Set data-sections by default in libLTO.
Author: Quinn Pham Date: 2022-07-27T08:34:40-05:00 New Revision: f565444b486d49f84297c3a279ca24d785961ea8 URL: https://github.com/llvm/llvm-project/commit/f565444b486d49f84297c3a279ca24d785961ea8 DIFF: https://github.com/llvm/llvm-project/commit/f565444b486d49f84297c3a279ca24d785961ea8.diff LOG: [libLTO] Set data-sections by default in libLTO. This patch changes legacy LTO to set data-sections by default. The user can explicitly unset data-sections. The reason for this patch is to match the behaviour of lld and gold plugin. Both lld and gold plugin have data-sections on by default. This patch also fixes the forwarding of the clang options -fno-data-sections and -fno-function-sections to libLTO. Now, when -fno-data/function-sections are specified in clang, -data/function-sections=0 will be passed to libLTO to explicitly unset data/function-sections. Reviewed By: w2yehia, MaskRay Differential Revision: https://reviews.llvm.org/D129401 Added: llvm/test/LTO/PowerPC/data-sections-aix.ll llvm/test/LTO/PowerPC/data-sections-linux.ll Modified: clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/function-sections.c llvm/lib/LTO/LTOCodeGenerator.cpp Removed: clang/test/Driver/gold-lto-sections.c diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 1d2c085d683e1..05afa712a809c 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -567,14 +567,16 @@ void tools::addLTOOptions(const ToolChain , const ArgList , isUseSeparateSections(ToolChain.getEffectiveTriple()); if (Args.hasFlag(options::OPT_ffunction_sections, - options::OPT_fno_function_sections, UseSeparateSections)) { -CmdArgs.push_back("-plugin-opt=-function-sections"); - } + options::OPT_fno_function_sections, UseSeparateSections)) +CmdArgs.push_back("-plugin-opt=-function-sections=1"); + else if (Args.hasArg(options::OPT_fno_function_sections)) +CmdArgs.push_back("-plugin-opt=-function-sections=0"); if (Args.hasFlag(options::OPT_fdata_sections, options::OPT_fno_data_sections, - UseSeparateSections)) { -CmdArgs.push_back("-plugin-opt=-data-sections"); - } + UseSeparateSections)) +CmdArgs.push_back("-plugin-opt=-data-sections=1"); + else if (Args.hasArg(options::OPT_fno_data_sections)) +CmdArgs.push_back("-plugin-opt=-data-sections=0"); // Pass an option to enable split machine functions. if (auto *A = Args.getLastArg(options::OPT_fsplit_machine_functions, diff --git a/clang/test/Driver/function-sections.c b/clang/test/Driver/function-sections.c index bfb6cc6920bd4..4d206ad150291 100644 --- a/clang/test/Driver/function-sections.c +++ b/clang/test/Driver/function-sections.c @@ -6,6 +6,12 @@ // CHECK-NODS-NOT: -fdata-sections // CHECK-US-NOT: -fno-unique-section-names // CHECK-NOUS: -fno-unique-section-names +// CHECK-PLUGIN-DEFAULT-NOT: "-plugin-opt=-function-sections +// CHECK-PLUGIN-DEFAULT-NOT: "-plugin-opt=-data-sections +// CHECK-PLUGIN-SECTIONS: "-plugin-opt=-function-sections=1" +// CHECK-PLUGIN-SECTIONS: "-plugin-opt=-data-sections=1" +// CHECK-PLUGIN-NO-SECTIONS: "-plugin-opt=-function-sections=0" +// CHECK-PLUGIN-NO-SECTIONS: "-plugin-opt=-data-sections=0" // RUN: %clang -### %s -fsyntax-only 2>&1 \ // RUN: --target=i386-unknown-linux \ @@ -72,3 +78,18 @@ // RUN: --target=i386-unknown-linux \ // RUN: -fno-unique-section-names \ // RUN: | FileCheck --check-prefix=CHECK-NOUS %s + + +// RUN: %clang -### %s -flto 2>&1\ +// RUN: --target=x86_64-unknown-linux \ +// RUN: | FileCheck --check-prefix=CHECK-PLUGIN-DEFAULT %s + +// RUN: %clang -### %s -flto 2>&1\ +// RUN: --target=x86_64-unknown-linux \ +// RUN: -ffunction-sections -fdata-sections \ +// RUN: | FileCheck --check-prefix=CHECK-PLUGIN-SECTIONS %s + +// RUN: %clang -### %s -flto 2>&1\ +// RUN: --target=x86_64-unknown-linux \ +// RUN: -fno-function-sections -fno-data-sections \ +// RUN: | FileCheck --check-prefix=CHECK-PLUGIN-NO-SECTIONS %s diff --git a/clang/test/Driver/gold-lto-sections.c b/clang/test/Driver/gold-lto-sections.c deleted file mode 100644 index 83d72cf7f97b8..0 --- a/clang/test/Driver/gold-lto-sections.c +++ /dev/null @@ -1,8 +0,0 @@ -// RUN: touch %t.o -// -// RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \ -// RUN: -Wl,-plugin-opt=foo -O3 \ -// RUN: -ffunction-sections -fdata-sections \ -// RUN: | FileCheck %s -// CHECK: "-plugin-opt=-function-sections" -// CHECK: "-plugin-opt=-data-sections" diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp index 2f7c485b9fc8f..8c374e0f2f858 100644 --- a/llvm/lib/LTO/LTOCodeGenerator.cpp +++
[clang] 35aaf54 - [clang][driver] fix to correctly set devtoolset on RHEL
Author: Quinn Pham Date: 2022-06-13T09:12:49-05:00 New Revision: 35aaf548237a4f213ba9d95de53b33c5ce1eadce URL: https://github.com/llvm/llvm-project/commit/35aaf548237a4f213ba9d95de53b33c5ce1eadce DIFF: https://github.com/llvm/llvm-project/commit/35aaf548237a4f213ba9d95de53b33c5ce1eadce.diff LOG: [clang][driver] fix to correctly set devtoolset on RHEL This patch correctly sets the devtoolset on RHEL. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D127310 Added: Modified: clang/lib/Driver/ToolChains/Gnu.cpp clang/unittests/Driver/ToolChainTest.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index c6ea1d026647..f4caa5e10609 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -2154,7 +2154,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( } if (ChosenToolsetVersion > 0) - Prefixes.push_back(ChosenToolsetDir); + Prefixes.push_back(ChosenToolsetDir + "/root/usr"); } // Fall back to /usr which is used by most non-Solaris systems. diff --git a/clang/unittests/Driver/ToolChainTest.cpp b/clang/unittests/Driver/ToolChainTest.cpp index 33389a52c6bb..3637b10cdd66 100644 --- a/clang/unittests/Driver/ToolChainTest.cpp +++ b/clang/unittests/Driver/ToolChainTest.cpp @@ -587,9 +587,9 @@ TEST(ToolChainTest, Toolsets) { llvm::MemoryBuffer::getMemBuffer("\n")); // File needed for GCC installation detection. -InMemoryFileSystem->addFile( -"/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11/crtbegin.o", 0, -llvm::MemoryBuffer::getMemBuffer("\n")); +InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-12/root/usr/lib/gcc/" +"x86_64-redhat-linux/11/crtbegin.o", +0, llvm::MemoryBuffer::getMemBuffer("\n")); DiagnosticsEngine Diags(DiagID, &*DiagOpts, new SimpleDiagnosticConsumer); Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags, @@ -603,9 +603,9 @@ TEST(ToolChainTest, Toolsets) { C->getDefaultToolChain().printVerboseInfo(OS); } EXPECT_EQ("Found candidate GCC installation: " - "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n" + "/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n" "Selected GCC installation: " - "/opt/rh/gcc-toolset-12/lib/gcc/x86_64-redhat-linux/11\n" + "/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n" "Candidate multilib: .;@m64\n" "Selected multilib: .;@m64\n", S); @@ -627,9 +627,9 @@ TEST(ToolChainTest, Toolsets) { llvm::MemoryBuffer::getMemBuffer("\n")); // File needed for GCC installation detection. -InMemoryFileSystem->addFile( -"/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11/crtbegin.o", 0, -llvm::MemoryBuffer::getMemBuffer("\n")); +InMemoryFileSystem->addFile("/opt/rh/devtoolset-12/root/usr/lib/gcc/" +"x86_64-redhat-linux/11/crtbegin.o", +0, llvm::MemoryBuffer::getMemBuffer("\n")); DiagnosticsEngine Diags(DiagID, &*DiagOpts, new SimpleDiagnosticConsumer); Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags, @@ -643,9 +643,9 @@ TEST(ToolChainTest, Toolsets) { C->getDefaultToolChain().printVerboseInfo(OS); } EXPECT_EQ("Found candidate GCC installation: " - "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n" + "/opt/rh/devtoolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n" "Selected GCC installation: " - "/opt/rh/devtoolset-12/lib/gcc/x86_64-redhat-linux/11\n" + "/opt/rh/devtoolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n" "Candidate multilib: .;@m64\n" "Selected multilib: .;@m64\n", S); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 0386213 - [clang][NFC] Inclusive language: remove use of Whitelist in clang/lib/Analysis/
Author: Quinn Pham Date: 2022-04-25T15:26:36-05:00 New Revision: 0386213352ec42342c756099fcfc6c1165d99e08 URL: https://github.com/llvm/llvm-project/commit/0386213352ec42342c756099fcfc6c1165d99e08 DIFF: https://github.com/llvm/llvm-project/commit/0386213352ec42342c756099fcfc6c1165d99e08.diff LOG: [clang][NFC] Inclusive language: remove use of Whitelist in clang/lib/Analysis/ [NFC] As part of using inclusive language within the llvm project, this patch rewords a comment to replace Whitelist with Allowlist in `RetainSummaryManager.cpp`. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D124389 Added: Modified: clang/lib/Analysis/RetainSummaryManager.cpp Removed: diff --git a/clang/lib/Analysis/RetainSummaryManager.cpp b/clang/lib/Analysis/RetainSummaryManager.cpp index 836e369758d38..9098cf370d4f5 100644 --- a/clang/lib/Analysis/RetainSummaryManager.cpp +++ b/clang/lib/Analysis/RetainSummaryManager.cpp @@ -398,7 +398,7 @@ const RetainSummary *RetainSummaryManager::getSummaryForObjCOrCFObject( } else if (FName.startswith("NSLog")) { return getDoNothingSummary(); } else if (FName.startswith("NS") && FName.contains("Insert")) { -// Whitelist NSXXInsertXX, for example NSMapInsertIfAbsent, since they can +// Allowlist NSXXInsertXX, for example NSMapInsertIfAbsent, since they can // be deallocated by NSMapRemove. (radar://11152419) ScratchArgs = AF.add(ScratchArgs, 1, ArgEffect(StopTracking)); ScratchArgs = AF.add(ScratchArgs, 2, ArgEffect(StopTracking)); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 6a02829 - [PowerPC] Emit warning when SP is clobbered by asm
Author: Quinn Pham Date: 2022-01-24T15:12:23-06:00 New Revision: 6a028296fe62252791a6b470eeb8409b17d48cd0 URL: https://github.com/llvm/llvm-project/commit/6a028296fe62252791a6b470eeb8409b17d48cd0 DIFF: https://github.com/llvm/llvm-project/commit/6a028296fe62252791a6b470eeb8409b17d48cd0.diff LOG: [PowerPC] Emit warning when SP is clobbered by asm This patch emits a warning when the stack pointer register (`R1`) is found in the clobber list of an inline asm statement. Clobbering the stack pointer is not supported. Reviewed By: #powerpc, nemanjai Differential Revision: https://reviews.llvm.org/D112073 Added: clang/test/Misc/ppc-inline-asm-clobber-warning.c llvm/test/CodeGen/PowerPC/inline-asm-clobber-warning.ll Modified: clang/lib/Basic/Targets/PPC.cpp llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp llvm/lib/Target/PowerPC/PPCRegisterInfo.h Removed: diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp index 19b7ded40402a..1eb0317af60b6 100644 --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -734,23 +734,28 @@ ArrayRef PPCTargetInfo::getGCCRegNames() const { const TargetInfo::GCCRegAlias PPCTargetInfo::GCCRegAliases[] = { // While some of these aliases do map to diff erent registers // they still share the same register name. -{{"0"}, "r0"}, {{"1"}, "r1"}, {{"2"}, "r2"}, {{"3"}, "r3"}, -{{"4"}, "r4"}, {{"5"}, "r5"}, {{"6"}, "r6"}, {{"7"}, "r7"}, -{{"8"}, "r8"}, {{"9"}, "r9"}, {{"10"}, "r10"}, {{"11"}, "r11"}, -{{"12"}, "r12"}, {{"13"}, "r13"}, {{"14"}, "r14"}, {{"15"}, "r15"}, -{{"16"}, "r16"}, {{"17"}, "r17"}, {{"18"}, "r18"}, {{"19"}, "r19"}, -{{"20"}, "r20"}, {{"21"}, "r21"}, {{"22"}, "r22"}, {{"23"}, "r23"}, -{{"24"}, "r24"}, {{"25"}, "r25"}, {{"26"}, "r26"}, {{"27"}, "r27"}, -{{"28"}, "r28"}, {{"29"}, "r29"}, {{"30"}, "r30"}, {{"31"}, "r31"}, -{{"fr0"}, "f0"}, {{"fr1"}, "f1"}, {{"fr2"}, "f2"}, {{"fr3"}, "f3"}, -{{"fr4"}, "f4"}, {{"fr5"}, "f5"}, {{"fr6"}, "f6"}, {{"fr7"}, "f7"}, -{{"fr8"}, "f8"}, {{"fr9"}, "f9"}, {{"fr10"}, "f10"}, {{"fr11"}, "f11"}, -{{"fr12"}, "f12"}, {{"fr13"}, "f13"}, {{"fr14"}, "f14"}, {{"fr15"}, "f15"}, -{{"fr16"}, "f16"}, {{"fr17"}, "f17"}, {{"fr18"}, "f18"}, {{"fr19"}, "f19"}, -{{"fr20"}, "f20"}, {{"fr21"}, "f21"}, {{"fr22"}, "f22"}, {{"fr23"}, "f23"}, -{{"fr24"}, "f24"}, {{"fr25"}, "f25"}, {{"fr26"}, "f26"}, {{"fr27"}, "f27"}, -{{"fr28"}, "f28"}, {{"fr29"}, "f29"}, {{"fr30"}, "f30"}, {{"fr31"}, "f31"}, -{{"cc"}, "cr0"}, +{{"0"}, "r0"}, {{"1", "sp"}, "r1"}, {{"2"}, "r2"}, +{{"3"}, "r3"}, {{"4"}, "r4"}, {{"5"}, "r5"}, +{{"6"}, "r6"}, {{"7"}, "r7"}, {{"8"}, "r8"}, +{{"9"}, "r9"}, {{"10"}, "r10"}, {{"11"}, "r11"}, +{{"12"}, "r12"}, {{"13"}, "r13"}, {{"14"}, "r14"}, +{{"15"}, "r15"}, {{"16"}, "r16"}, {{"17"}, "r17"}, +{{"18"}, "r18"}, {{"19"}, "r19"}, {{"20"}, "r20"}, +{{"21"}, "r21"}, {{"22"}, "r22"}, {{"23"}, "r23"}, +{{"24"}, "r24"}, {{"25"}, "r25"}, {{"26"}, "r26"}, +{{"27"}, "r27"}, {{"28"}, "r28"}, {{"29"}, "r29"}, +{{"30"}, "r30"}, {{"31"}, "r31"}, {{"fr0"}, "f0"}, +{{"fr1"}, "f1"}, {{"fr2"}, "f2"}, {{"fr3"}, "f3"}, +{{"fr4"}, "f4"}, {{"fr5"}, "f5"}, {{"fr6"}, "f6"}, +{{"fr7"}, "f7"}, {{"fr8"}, "f8"}, {{"fr9"}, "f9"}, +{{"fr10"}, "f10"}, {{"fr11"}, "f11"}, {{"fr12"}, "f12"}, +{{"fr13"}, "f13"}, {{"fr14"}, "f14"}, {{"fr15"}, "f15"}, +{{"fr16"}, "f16"}, {{"fr17"}, "f17"}, {{"fr18"}, "f18"}, +{{"fr19"}, "f19"}, {{"fr20"}, "f20"}, {{"fr21"}, "f21"}, +{{"fr22"}, "f22"}, {{"fr23"}, "f23"}, {{"fr24"}, "f24"}, +{{"fr25"}, "f25"}, {{"fr26"}, "f26"}, {{"fr27"}, "f27"}, +{{"fr28"}, "f28"}, {{"fr29"}, "f29"}, {{"fr30"}, "f30"}, +{{"fr31"}, "f31"}, {{"cc"}, "cr0"}, }; ArrayRef PPCTargetInfo::getGCCRegAliases() const { diff --git a/clang/test/Misc/ppc-inline-asm-clobber-warning.c b/clang/test/Misc/ppc-inline-asm-clobber-warning.c new file mode 100644 index 0..bc323243b6e2d --- /dev/null +++ b/clang/test/Misc/ppc-inline-asm-clobber-warning.c @@ -0,0 +1,38 @@ +/// This test checks that the warning includes the location in the C source +/// file that contains the inline asm. Although this warning is emitted in llvm +/// it cannot be tested from IR as it does not have that location information at +/// that stage. + +// REQUIRES: powerpc-registered-target + +// RUN: %clang --target=powerpc-unknown-unknown -mcpu=pwr7 \ +// RUN: -c %s -o /dev/null 2>&1 | FileCheck %s +// RUN: %clang --target=powerpc64-unknown-unknown -mcpu=pwr7 \ +// RUN: -c %s -o /dev/null 2>&1 | FileCheck %s + +void test_r1_clobber() { + __asm__("nop":::"r1"); +} + +// CHECK:
[clang] b11c66a - [NFC] Inclusive language: rename master flag to main flag
Author: Quinn Pham Date: 2021-11-25T15:16:11-06:00 New Revision: b11c66accfb1d78324278072ed0069d3bbe835cd URL: https://github.com/llvm/llvm-project/commit/b11c66accfb1d78324278072ed0069d3bbe835cd DIFF: https://github.com/llvm/llvm-project/commit/b11c66accfb1d78324278072ed0069d3bbe835cd.diff LOG: [NFC] Inclusive language: rename master flag to main flag [NFC] As part of using inclusive language within the llvm project, this patch renames master flag to main flag in these comments. Reviewed By: ZarkoCA Differential Revision: https://reviews.llvm.org/D114090 Added: Modified: clang/lib/Driver/ToolChains/Clang.cpp llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 0f20abac043ca..5b773621a4af9 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -403,7 +403,7 @@ shouldUseExceptionTablesForObjCExceptions(const ObjCRuntime , } /// Adds exception related arguments to the driver command arguments. There's a -/// master flag, -fexceptions and also language specific flags to enable/disable +/// main flag, -fexceptions and also language specific flags to enable/disable /// C++ and Objective-C exceptions. This makes it possible to for example /// disable C++ exceptions but enable Objective-C exceptions. static bool addExceptionArgs(const ArgList , types::ID InputType, diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp index d4f39b5713941..70208ee5b806b 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp @@ -148,7 +148,7 @@ class X86AsmBackend : public MCAsmBackend { AlignBranchType.addKind(X86::AlignBranchJcc); AlignBranchType.addKind(X86::AlignBranchJmp); } -// Allow overriding defaults set by master flag +// Allow overriding defaults set by main flag if (X86AlignBranchBoundary.getNumOccurrences()) AlignBoundary = assumeAligned(X86AlignBranchBoundary); if (X86AlignBranch.getNumOccurrences()) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] c3dc6b0 - [NFC][clang-tools-extra] Inclusive language: replace master with main
Author: Quinn Pham Date: 2021-11-25T11:01:16-06:00 New Revision: c3dc6b081da6ba503e67d260033f81f61eb38ea3 URL: https://github.com/llvm/llvm-project/commit/c3dc6b081da6ba503e67d260033f81f61eb38ea3 DIFF: https://github.com/llvm/llvm-project/commit/c3dc6b081da6ba503e67d260033f81f61eb38ea3.diff LOG: [NFC][clang-tools-extra] Inclusive language: replace master with main [NFC] As part of using inclusive language within the llvm project, this patch replaces master with main in `SubModule2.h`. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D114100 Added: Modified: clang-tools-extra/test/modularize/SubModule2.h Removed: diff --git a/clang-tools-extra/test/modularize/SubModule2.h b/clang-tools-extra/test/modularize/SubModule2.h index 70d711b7e36c4..b2e5a626ac459 100644 --- a/clang-tools-extra/test/modularize/SubModule2.h +++ b/clang-tools-extra/test/modularize/SubModule2.h @@ -1,3 +1,3 @@ -// SubModule2.h - Master header with same name as directory. +// SubModule2.h - Main header with same name as directory. #include "SubModule2/Header3.h" #include "SubModule2/Header4.h" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] ad50105 - [NFC][clang] Inclusive language: rename master variable to controller in debug-info tests
Author: Quinn Pham Date: 2021-11-22T14:02:54-06:00 New Revision: ad501054f1b5ce0aca47c931aa03a22706e4ff8d URL: https://github.com/llvm/llvm-project/commit/ad501054f1b5ce0aca47c931aa03a22706e4ff8d DIFF: https://github.com/llvm/llvm-project/commit/ad501054f1b5ce0aca47c931aa03a22706e4ff8d.diff LOG: [NFC][clang] Inclusive language: rename master variable to controller in debug-info tests [NFC] As part of using inclusive language within the llvm project, this patch replaces master with controller in these tests. Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D114108 Added: Modified: clang/test/CodeGenObjC/debug-info-block-helper.m cross-project-tests/debuginfo-tests/llgdb-tests/blocks.m Removed: diff --git a/clang/test/CodeGenObjC/debug-info-block-helper.m b/clang/test/CodeGenObjC/debug-info-block-helper.m index 914962897fd4a..ac4ba39976b7e 100644 --- a/clang/test/CodeGenObjC/debug-info-block-helper.m +++ b/clang/test/CodeGenObjC/debug-info-block-helper.m @@ -12,17 +12,17 @@ @interface NSObject { @interface A:NSObject @end @implementation A - (void) helper { - int master = 0; + int controller = 0; __block int m2 = 0; __block int dbTransaction = 0; int (^x)(void) = ^(void) { (void) self; - (void) master; + (void) controller; (void) dbTransaction; m2++; return m2; }; - master = x(); + controller = x(); } @end diff --git a/cross-project-tests/debuginfo-tests/llgdb-tests/blocks.m b/cross-project-tests/debuginfo-tests/llgdb-tests/blocks.m index 8e5a21213200d..79ec6fd271e8a 100644 --- a/cross-project-tests/debuginfo-tests/llgdb-tests/blocks.m +++ b/cross-project-tests/debuginfo-tests/llgdb-tests/blocks.m @@ -11,7 +11,7 @@ // CHECK: ${{[0-9]}} = 1 // DEBUGGER: p dbTransaction // CHECK: ${{[0-9]}} = 0 -// DEBUGGER: p master +// DEBUGGER: p controller // CHECK: ${{[0-9]}} = 0 #include @@ -21,16 +21,16 @@ @interface A:NSObject @end @implementation A - (void) helper { - int master = 0; + int controller = 0; __block int m2 = 0; __block int dbTransaction = 0; int (^x)(void) = ^(void) { (void) self; - (void) master; + (void) controller; (void) dbTransaction; m2++; return m2; }; - master = x(); + controller = x(); } @end ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 7a14244 - [NFC][clang] Inclusive language: replace masterPort with mainPort
Author: Quinn Pham Date: 2021-11-18T11:51:06-06:00 New Revision: 7a14244cc645bbbcbf5056e7a00fadbb339e92ed URL: https://github.com/llvm/llvm-project/commit/7a14244cc645bbbcbf5056e7a00fadbb339e92ed DIFF: https://github.com/llvm/llvm-project/commit/7a14244cc645bbbcbf5056e7a00fadbb339e92ed.diff LOG: [NFC][clang] Inclusive language: replace masterPort with mainPort [NFC] This patch replaces `masterPort` with `mainPort` in these testcases. Reviewed By: ZarkoCA Differential Revision: https://reviews.llvm.org/D113505 Added: Modified: clang/test/ARCMT/objcmt-arc-cf-annotations.m clang/test/ARCMT/objcmt-arc-cf-annotations.m.result clang/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist clang/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist clang/test/Analysis/retain-release-inline.m clang/test/Analysis/retain-release.m clang/test/Analysis/retain-release.mm Removed: diff --git a/clang/test/ARCMT/objcmt-arc-cf-annotations.m b/clang/test/ARCMT/objcmt-arc-cf-annotations.m index c9a5b8215d10..e33b8801cd4d 100644 --- a/clang/test/ARCMT/objcmt-arc-cf-annotations.m +++ b/clang/test/ARCMT/objcmt-arc-cf-annotations.m @@ -220,14 +220,14 @@ - (void)setObject:(id)anObject forKey:(id)aKey; typedef io_object_t io_service_t; typedef struct IONotificationPort * IONotificationPortRef; typedef void (*IOServiceMatchingCallback)( void * refcon, io_iterator_t iterator ); -io_service_t IOServiceGetMatchingService( mach_port_t masterPort, CFDictionaryRef matching ); -kern_return_t IOServiceGetMatchingServices( mach_port_t masterPort, CFDictionaryRef matching, io_iterator_t * existing ); -kern_return_t IOServiceAddNotification( mach_port_t masterPort, const io_name_t notificationType, CFDictionaryRef matching, mach_port_t wakePort, uintptr_t reference, io_iterator_t * notification ) __attribute__((deprecated)); // expected-note {{'IOServiceAddNotification' declared here}} +io_service_t IOServiceGetMatchingService( mach_port_t mainPort, CFDictionaryRef matching ); +kern_return_t IOServiceGetMatchingServices( mach_port_t mainPort, CFDictionaryRef matching, io_iterator_t * existing ); +kern_return_t IOServiceAddNotification( mach_port_t mainPort, const io_name_t notificationType, CFDictionaryRef matching, mach_port_t wakePort, uintptr_t reference, io_iterator_t * notification ) __attribute__((deprecated)); // expected-note {{'IOServiceAddNotification' declared here}} kern_return_t IOServiceAddMatchingNotification( IONotificationPortRef notifyPort, const io_name_t notificationType, CFDictionaryRef matching, IOServiceMatchingCallback callback, void * refCon, io_iterator_t * notification ); CFMutableDictionaryRef IOServiceMatching( const char * name ); CFMutableDictionaryRef IOServiceNameMatching( const char * name ); -CFMutableDictionaryRef IOBSDNameMatching( mach_port_t masterPort, uint32_t options, const char * bsdName ); -CFMutableDictionaryRef IOOpenFirmwarePathMatching( mach_port_t masterPort, uint32_t options, const char * path ); +CFMutableDictionaryRef IOBSDNameMatching( mach_port_t mainPort, uint32_t options, const char * bsdName ); +CFMutableDictionaryRef IOOpenFirmwarePathMatching( mach_port_t mainPort, uint32_t options, const char * path ); CFMutableDictionaryRef IORegistryEntryIDMatching( uint64_t entryID ); typedef struct __DASession * DASessionRef; extern DASessionRef DASessionCreate( CFAllocatorRef allocator ); @@ -964,8 +964,8 @@ void rdar6945561(CIContext *context, CGSize size, CFDictionaryRef d) { // checker //===--===// -void IOBSDNameMatching_wrapper(mach_port_t masterPort, uint32_t options, const char * bsdName) { - IOBSDNameMatching(masterPort, options, bsdName); // expected-warning{{leak}} +void IOBSDNameMatching_wrapper(mach_port_t mainPort, uint32_t options, const char * bsdName) { + IOBSDNameMatching(mainPort, options, bsdName); // expected-warning{{leak}} } void IOServiceMatching_wrapper(const char * name) { @@ -978,12 +978,12 @@ void IOServiceNameMatching_wrapper(const char * name) { CF_RETURNS_RETAINED CFDictionaryRef CreateDict(); -void IOServiceAddNotification_wrapper(mach_port_t masterPort, const io_name_t notificationType, +void IOServiceAddNotification_wrapper(mach_port_t mainPort, const io_name_t notificationType, mach_port_t wakePort, uintptr_t reference, io_iterator_t * notification ) { CFDictionaryRef matching = CreateDict(); CFRelease(matching); - IOServiceAddNotification(masterPort, notificationType, matching, // expected-warning{{used after it is released}} expected-warning{{deprecated}} + IOServiceAddNotification(mainPort, notificationType, matching, // expected-warning{{used after it is released}}
[clang] 5ed404a - [NFC][clang] Inclusive language: Rename myMaster in testcase
Author: Quinn Pham Date: 2021-11-16T11:46:43-06:00 New Revision: 5ed404a4abd3fc3559ecc9dfc6cee83fcc3796e6 URL: https://github.com/llvm/llvm-project/commit/5ed404a4abd3fc3559ecc9dfc6cee83fcc3796e6 DIFF: https://github.com/llvm/llvm-project/commit/5ed404a4abd3fc3559ecc9dfc6cee83fcc3796e6.diff LOG: [NFC][clang] Inclusive language: Rename myMaster in testcase [NFC] As part of using inclusive language within the llvm project, this patch replaces `_myMaster` with `_myLeader` in these testcases. Reviewed By: ZarkoCA Differential Revision: https://reviews.llvm.org/D113433 Added: Modified: clang/test/Rewriter/line-generation-test.m clang/test/SemaObjC/warn-direct-ivar-access.m Removed: diff --git a/clang/test/Rewriter/line-generation-test.m b/clang/test/Rewriter/line-generation-test.m index cafdba2808479..5193775fbedb2 100644 --- a/clang/test/Rewriter/line-generation-test.m +++ b/clang/test/Rewriter/line-generation-test.m @@ -7,20 +7,20 @@ __attribute__((objc_root_class)) @interface MyObject { @public -id _myMaster; +id _myLeader; id _isTickledPink; } -@property(retain) id myMaster; +@property(retain) id myLeader; @property(assign) id isTickledPink; @end @implementation MyObject -@synthesize myMaster = _myMaster; +@synthesize myLeader = _myLeader; @synthesize isTickledPink = _isTickledPink; - (void) doSomething { -_myMaster = _isTickledPink; +_myLeader = _isTickledPink; } @end @@ -28,8 +28,8 @@ - (void) doSomething { MyObject * foo () { MyObject* p; -p.isTickledPink = p.myMaster; // ok - p->_isTickledPink = p->_myMaster; +p.isTickledPink = p.myLeader; // ok + p->_isTickledPink = p->_myLeader; return p->_isTickledPink; } diff --git a/clang/test/SemaObjC/warn-direct-ivar-access.m b/clang/test/SemaObjC/warn-direct-ivar-access.m index d34e5f1894d2e..946e516aad8fb 100644 --- a/clang/test/SemaObjC/warn-direct-ivar-access.m +++ b/clang/test/SemaObjC/warn-direct-ivar-access.m @@ -3,39 +3,39 @@ __attribute__((objc_root_class)) @interface MyObject { @public -id _myMaster; +id _myLeader; id _isTickledPink; // expected-error {{existing instance variable '_isTickledPink' for property 'isTickledPink'}} int _myIntProp; } -@property(retain) id myMaster; +@property(retain) id myLeader; @property(assign) id isTickledPink; // expected-note {{property declared here}} @property int myIntProp; @end @implementation MyObject -@synthesize myMaster = _myMaster; +@synthesize myLeader = _myLeader; @synthesize isTickledPink = _isTickledPink; // expected-note {{property synthesized here}} @synthesize myIntProp = _myIntProp; - (void) doSomething { -_myMaster = _isTickledPink; // expected-warning {{instance variable '_myMaster' is being directly accessed}} \ +_myLeader = _isTickledPink; // expected-warning {{instance variable '_myLeader' is being directly accessed}} \ // expected-warning {{instance variable '_isTickledPink' is being directly accessed}} } - (id) init { -_myMaster=0; -return _myMaster; +_myLeader=0; +return _myLeader; } -- (void) dealloc { _myMaster = 0; } +- (void) dealloc { _myLeader = 0; } @end MyObject * foo () { MyObject* p=0; -p.isTickledPink = p.myMaster; // ok - p->_isTickledPink = (*p)._myMaster; // expected-warning {{instance variable '_isTickledPink' is being directly accessed}} \ -// expected-warning {{instance variable '_myMaster' is being directly accessed}} +p.isTickledPink = p.myLeader; // ok + p->_isTickledPink = (*p)._myLeader; // expected-warning {{instance variable '_isTickledPink' is being directly accessed}} \ +// expected-warning {{instance variable '_myLeader' is being directly accessed}} if (p->_myIntProp) // expected-warning {{instance variable '_myIntProp' is being directly accessed}} p->_myIntProp = 0; // expected-warning {{instance variable '_myIntProp' is being directly accessed}} return p->_isTickledPink; // expected-warning {{instance variable '_isTickledPink' is being directly accessed}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] d4b28a0 - [NFC][clang] Inclusive language: replace master with main in convert_arm_neon.py
Author: Quinn Pham Date: 2021-11-16T10:11:06-06:00 New Revision: d4b28a0fe6857e0404d07b0989eeced05eaa45e7 URL: https://github.com/llvm/llvm-project/commit/d4b28a0fe6857e0404d07b0989eeced05eaa45e7 DIFF: https://github.com/llvm/llvm-project/commit/d4b28a0fe6857e0404d07b0989eeced05eaa45e7.diff LOG: [NFC][clang] Inclusive language: replace master with main in convert_arm_neon.py [NFC] As part of using inclusive language within the llvm project and to match the renamed master branch, this patch replaces master with main in `convert_arm_neon.py`. Reviewed By: kristof.beyls Differential Revision: https://reviews.llvm.org/D113942 Added: Modified: clang/utils/convert_arm_neon.py Removed: diff --git a/clang/utils/convert_arm_neon.py b/clang/utils/convert_arm_neon.py index c4b3645294573..bb3516b07b577 100644 --- a/clang/utils/convert_arm_neon.py +++ b/clang/utils/convert_arm_neon.py @@ -7,7 +7,7 @@ # using the old single-char type modifiers to an equivalent new-style form where # each modifier is orthogonal and they can be composed. # -# It was used to directly generate the .td files on master, so if you have any +# It was used to directly generate the .td files on main, so if you have any # local additions I would suggest implementing any modifiers here, and running # it over your entire pre-merge .td files rather than trying to resolve any # conflicts manually. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] c3b15b7 - [NFC] Inclusive Language: change master to main for .chm files
Author: Quinn Pham Date: 2021-11-08T08:23:04-06:00 New Revision: c3b15b71ce009b3dff9fb3bd664d087057b8376e URL: https://github.com/llvm/llvm-project/commit/c3b15b71ce009b3dff9fb3bd664d087057b8376e DIFF: https://github.com/llvm/llvm-project/commit/c3b15b71ce009b3dff9fb3bd664d087057b8376e.diff LOG: [NFC] Inclusive Language: change master to main for .chm files [NFC] As part of using inclusive language within the llvm project, this patch replaces master with main when referring to `.chm` files. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D113299 Added: Modified: clang-tools-extra/docs/doxygen.cfg.in clang/docs/doxygen.cfg.in flang/docs/doxygen.cfg.in lldb/docs/doxygen.cfg.in llvm/docs/doxygen.cfg.in mlir/docs/doxygen.cfg.in openmp/docs/doxygen.cfg.in openmp/runtime/doc/doxygen/config polly/docs/doxygen.cfg.in Removed: diff --git a/clang-tools-extra/docs/doxygen.cfg.in b/clang-tools-extra/docs/doxygen.cfg.in index d778be30b63e..7e1d47a7a95a 100644 --- a/clang-tools-extra/docs/doxygen.cfg.in +++ b/clang-tools-extra/docs/doxygen.cfg.in @@ -1230,7 +1230,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). +# YES) or that it should be included in the main .chm file ( NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. diff --git a/clang/docs/doxygen.cfg.in b/clang/docs/doxygen.cfg.in index 449552d99d46..39a346409b93 100644 --- a/clang/docs/doxygen.cfg.in +++ b/clang/docs/doxygen.cfg.in @@ -1219,7 +1219,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). +# YES) or that it should be included in the main .chm file ( NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. diff --git a/flang/docs/doxygen.cfg.in b/flang/docs/doxygen.cfg.in index 7ede0b0a8b3b..6ee771c23d2b 100644 --- a/flang/docs/doxygen.cfg.in +++ b/flang/docs/doxygen.cfg.in @@ -1222,7 +1222,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). +# YES) or that it should be included in the main .chm file ( NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. diff --git a/lldb/docs/doxygen.cfg.in b/lldb/docs/doxygen.cfg.in index 7750d89fd267..5712779e6b2c 100644 --- a/lldb/docs/doxygen.cfg.in +++ b/lldb/docs/doxygen.cfg.in @@ -916,7 +916,7 @@ HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). +# it should be included in the main .chm file (NO). GENERATE_CHI = NO diff --git a/llvm/docs/doxygen.cfg.in b/llvm/docs/doxygen.cfg.in index 7a6d531ad255..b19ca6d21580 100644 --- a/llvm/docs/doxygen.cfg.in +++ b/llvm/docs/doxygen.cfg.in @@ -1220,7 +1220,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). +# YES) or that it should be included in the main .chm file ( NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. diff --git a/mlir/docs/doxygen.cfg.in b/mlir/docs/doxygen.cfg.in index 307981eed5f2..a0e4465c7dec 100644 --- a/mlir/docs/doxygen.cfg.in +++ b/mlir/docs/doxygen.cfg.in @@ -1220,7 +1220,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). +# YES) or that it should be included in the main .chm file ( NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. diff --git a/openmp/docs/doxygen.cfg.in b/openmp/docs/doxygen.cfg.in index f02c70336040..f52c234da05d 100644 --- a/openmp/docs/doxygen.cfg.in +++ b/openmp/docs/doxygen.cfg.in @@ -1220,7 +1220,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). +# YES) or that it should be included in the main .chm file ( NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. diff --git a/openmp/runtime/doc/doxygen/config b/openmp/runtime/doc/doxygen/config index
[clang] c3b15b7 - [NFC] Inclusive Language: change master to main for .chm files
Author: Quinn Pham Date: 2021-11-08T08:23:04-06:00 New Revision: c3b15b71ce009b3dff9fb3bd664d087057b8376e URL: https://github.com/llvm/llvm-project/commit/c3b15b71ce009b3dff9fb3bd664d087057b8376e DIFF: https://github.com/llvm/llvm-project/commit/c3b15b71ce009b3dff9fb3bd664d087057b8376e.diff LOG: [NFC] Inclusive Language: change master to main for .chm files [NFC] As part of using inclusive language within the llvm project, this patch replaces master with main when referring to `.chm` files. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D113299 Added: Modified: clang-tools-extra/docs/doxygen.cfg.in clang/docs/doxygen.cfg.in flang/docs/doxygen.cfg.in lldb/docs/doxygen.cfg.in llvm/docs/doxygen.cfg.in mlir/docs/doxygen.cfg.in openmp/docs/doxygen.cfg.in openmp/runtime/doc/doxygen/config polly/docs/doxygen.cfg.in Removed: diff --git a/clang-tools-extra/docs/doxygen.cfg.in b/clang-tools-extra/docs/doxygen.cfg.in index d778be30b63e..7e1d47a7a95a 100644 --- a/clang-tools-extra/docs/doxygen.cfg.in +++ b/clang-tools-extra/docs/doxygen.cfg.in @@ -1230,7 +1230,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). +# YES) or that it should be included in the main .chm file ( NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. diff --git a/clang/docs/doxygen.cfg.in b/clang/docs/doxygen.cfg.in index 449552d99d46..39a346409b93 100644 --- a/clang/docs/doxygen.cfg.in +++ b/clang/docs/doxygen.cfg.in @@ -1219,7 +1219,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). +# YES) or that it should be included in the main .chm file ( NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. diff --git a/flang/docs/doxygen.cfg.in b/flang/docs/doxygen.cfg.in index 7ede0b0a8b3b..6ee771c23d2b 100644 --- a/flang/docs/doxygen.cfg.in +++ b/flang/docs/doxygen.cfg.in @@ -1222,7 +1222,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). +# YES) or that it should be included in the main .chm file ( NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. diff --git a/lldb/docs/doxygen.cfg.in b/lldb/docs/doxygen.cfg.in index 7750d89fd267..5712779e6b2c 100644 --- a/lldb/docs/doxygen.cfg.in +++ b/lldb/docs/doxygen.cfg.in @@ -916,7 +916,7 @@ HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). +# it should be included in the main .chm file (NO). GENERATE_CHI = NO diff --git a/llvm/docs/doxygen.cfg.in b/llvm/docs/doxygen.cfg.in index 7a6d531ad255..b19ca6d21580 100644 --- a/llvm/docs/doxygen.cfg.in +++ b/llvm/docs/doxygen.cfg.in @@ -1220,7 +1220,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). +# YES) or that it should be included in the main .chm file ( NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. diff --git a/mlir/docs/doxygen.cfg.in b/mlir/docs/doxygen.cfg.in index 307981eed5f2..a0e4465c7dec 100644 --- a/mlir/docs/doxygen.cfg.in +++ b/mlir/docs/doxygen.cfg.in @@ -1220,7 +1220,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). +# YES) or that it should be included in the main .chm file ( NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. diff --git a/openmp/docs/doxygen.cfg.in b/openmp/docs/doxygen.cfg.in index f02c70336040..f52c234da05d 100644 --- a/openmp/docs/doxygen.cfg.in +++ b/openmp/docs/doxygen.cfg.in @@ -1220,7 +1220,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). +# YES) or that it should be included in the main .chm file ( NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. diff --git a/openmp/runtime/doc/doxygen/config b/openmp/runtime/doc/doxygen/config index
[clang] 67a3d1e - [PowerPC] swdiv builtins for XL compatibility
Author: Quinn Pham Date: 2021-09-29T11:31:07-05:00 New Revision: 67a3d1e2755152608fcb1737f7d0519121e037b7 URL: https://github.com/llvm/llvm-project/commit/67a3d1e2755152608fcb1737f7d0519121e037b7 DIFF: https://github.com/llvm/llvm-project/commit/67a3d1e2755152608fcb1737f7d0519121e037b7.diff LOG: [PowerPC] swdiv builtins for XL compatibility This patch is in a series of patches to provide builtins for compatibility with the XL compiler. This patch implements the software divide builtin as wrappers for a floating point divide. XL provided these builtins because it didn't produce software estimates by default at `-Ofast`. When compiled with `-Ofast` these builtins will produce the software estimate for divide. Reviewed By: #powerpc, nemanjai Differential Revision: https://reviews.llvm.org/D106959 Added: clang/test/CodeGen/builtins-ppc-xlcompat-swdiv.c Modified: clang/include/clang/Basic/BuiltinsPPC.def clang/lib/Basic/Targets/PPC.cpp clang/lib/CodeGen/CGBuiltin.cpp llvm/test/CodeGen/PowerPC/fdiv.ll Removed: diff --git a/clang/include/clang/Basic/BuiltinsPPC.def b/clang/include/clang/Basic/BuiltinsPPC.def index 6fee978530dd..26286c270905 100644 --- a/clang/include/clang/Basic/BuiltinsPPC.def +++ b/clang/include/clang/Basic/BuiltinsPPC.def @@ -101,6 +101,8 @@ BUILTIN(__builtin_ppc_compare_exp_lt, "idd", "") BUILTIN(__builtin_ppc_compare_exp_gt, "idd", "") BUILTIN(__builtin_ppc_compare_exp_eq, "idd", "") BUILTIN(__builtin_ppc_test_data_class, "idIi", "t") +BUILTIN(__builtin_ppc_swdiv, "ddd", "") +BUILTIN(__builtin_ppc_swdivs, "fff", "") // Compare BUILTIN(__builtin_ppc_cmpeqb, "LLiLLiLLi", "") BUILTIN(__builtin_ppc_cmprb, "iCIiii", "") diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp index 4835f1d81674..21376b328a24 100644 --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -243,6 +243,8 @@ static void defineXLCompatMacros(MacroBuilder ) { Builder.defineMacro("__compare_exp_gt", "__builtin_ppc_compare_exp_gt"); Builder.defineMacro("__compare_exp_eq", "__builtin_ppc_compare_exp_eq"); Builder.defineMacro("__test_data_class", "__builtin_ppc_test_data_class"); + Builder.defineMacro("__swdiv", "__builtin_ppc_swdiv"); + Builder.defineMacro("__swdivs", "__builtin_ppc_swdivs"); } /// PPCTargetInfo::getTargetDefines - Return a set of the PowerPC-specific diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index fe532a7d2498..c7dcde149a15 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -16077,7 +16077,7 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID, *this, E, Intrinsic::sqrt, Intrinsic::experimental_constrained_sqrt)) .getScalarVal(); - case PPC::BI__builtin_ppc_test_data_class: + case PPC::BI__builtin_ppc_test_data_class: { llvm::Type *ArgType = EmitScalarExpr(E->getArg(0))->getType(); unsigned IntrinsicID; if (ArgType->isDoubleTy()) @@ -16089,6 +16089,10 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID, return Builder.CreateCall(CGM.getIntrinsic(IntrinsicID), Ops, "test_data_class"); } + case PPC::BI__builtin_ppc_swdiv: + case PPC::BI__builtin_ppc_swdivs: +return Builder.CreateFDiv(Ops[0], Ops[1], "swdiv"); + } } namespace { diff --git a/clang/test/CodeGen/builtins-ppc-xlcompat-swdiv.c b/clang/test/CodeGen/builtins-ppc-xlcompat-swdiv.c new file mode 100644 index ..33b3f149664b --- /dev/null +++ b/clang/test/CodeGen/builtins-ppc-xlcompat-swdiv.c @@ -0,0 +1,80 @@ +// REQUIRES: powerpc-registered-target +// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu \ +// RUN: -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu \ +// RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64-unknown-aix \ +// RUN: -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s +// RUN: %clang_cc1 -triple powerpc-unknown-aix \ +// RUN: -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -ffast-math -ffp-contract=fast \ +// RUN: -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s --check-prefix CHECK-OFAST + +extern double a; +extern double b; +extern float c; +extern float d; + +// CHECK-LABEL: @test_swdiv( +// CHECK: [[TMP0:%.*]] = load double, double* @a +// CHECK-NEXT:[[TMP1:%.*]] = load double, double* @b +// CHECK-NEXT:[[SWDIV:%.*]] = fdiv double [[TMP0]], [[TMP1]] +// CHECK-NEXT:ret double [[SWDIV]] +// +// CHECK-OFAST-LABEL: @test_swdiv( +// CHECK-OFAST: [[TMP0:%.*]] = load double, double* @a +// CHECK-OFAST-NEXT:[[TMP1:%.*]] = load double, double* @b +// CHECK-OFAST-NEXT:[[SWDIV:%.*]] = fdiv
[clang] 70391b3 - [PowerPC] FP compare and test XL compat builtins.
Author: Quinn Pham Date: 2021-09-28T11:01:51-05:00 New Revision: 70391b3468b8a4a07b49df88d7fa88c9644cda77 URL: https://github.com/llvm/llvm-project/commit/70391b3468b8a4a07b49df88d7fa88c9644cda77 DIFF: https://github.com/llvm/llvm-project/commit/70391b3468b8a4a07b49df88d7fa88c9644cda77.diff LOG: [PowerPC] FP compare and test XL compat builtins. This patch is in a series of patches to provide builtins for compatability with the XL compiler. This patch adds builtins for compare exponent and test data class operations on floating point values. Reviewed By: #powerpc, lei Differential Revision: https://reviews.llvm.org/D109437 Added: clang/test/CodeGen/builtins-ppc-xlcompat-test.c llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-test.ll Modified: clang/include/clang/Basic/BuiltinsPPC.def clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib/Basic/Targets/PPC.cpp clang/lib/CodeGen/CGBuiltin.cpp clang/lib/Sema/SemaChecking.cpp clang/test/CodeGen/builtins-ppc-xlcompat-pwr9-error.c llvm/include/llvm/IR/IntrinsicsPowerPC.td llvm/lib/Target/PowerPC/PPCISelLowering.cpp Removed: diff --git a/clang/include/clang/Basic/BuiltinsPPC.def b/clang/include/clang/Basic/BuiltinsPPC.def index ba865def5b48a..76c953272b4db 100644 --- a/clang/include/clang/Basic/BuiltinsPPC.def +++ b/clang/include/clang/Basic/BuiltinsPPC.def @@ -96,6 +96,11 @@ BUILTIN(__builtin_ppc_swdiv_nochk, "ddd", "") BUILTIN(__builtin_ppc_swdivs_nochk, "fff", "") BUILTIN(__builtin_ppc_alignx, "vIivC*", "nc") BUILTIN(__builtin_ppc_rdlam, "UWiUWiUWiUWIi", "nc") +BUILTIN(__builtin_ppc_compare_exp_uo, "idd", "") +BUILTIN(__builtin_ppc_compare_exp_lt, "idd", "") +BUILTIN(__builtin_ppc_compare_exp_gt, "idd", "") +BUILTIN(__builtin_ppc_compare_exp_eq, "idd", "") +BUILTIN(__builtin_ppc_test_data_class, "idIi", "t") // Compare BUILTIN(__builtin_ppc_cmpeqb, "LLiLLiLLi", "") BUILTIN(__builtin_ppc_cmprb, "iCIiii", "") diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 5a3eab540d1fe..07c5e85913712 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -9778,8 +9778,12 @@ def err_mips_builtin_requires_msa : Error< "this builtin requires 'msa' ASE, please use -mmsa">; def err_ppc_builtin_only_on_arch : Error< "this builtin is only valid on POWER%0 or later CPUs">; +def err_ppc_builtin_requires_vsx : Error< + "this builtin requires VSX to be enabled">; def err_ppc_invalid_use_mma_type : Error< "invalid use of PPC MMA type">; +def err_ppc_invalid_test_data_class_type : Error< + "expected a 'float' or 'double' for the first argument">; def err_x86_builtin_invalid_rounding : Error< "invalid rounding argument">; def err_x86_builtin_invalid_scale : Error< diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp index 8f16f3d9b475c..8ada8c5106b31 100644 --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -238,6 +238,11 @@ static void defineXLCompatMacros(MacroBuilder ) { Builder.defineMacro("__fsqrts", "__builtin_ppc_fsqrts"); Builder.defineMacro("__addex", "__builtin_ppc_addex"); Builder.defineMacro("__cmplxl", "__builtin_complex"); + Builder.defineMacro("__compare_exp_uo", "__builtin_ppc_compare_exp_uo"); + Builder.defineMacro("__compare_exp_lt", "__builtin_ppc_compare_exp_lt"); + Builder.defineMacro("__compare_exp_gt", "__builtin_ppc_compare_exp_gt"); + Builder.defineMacro("__compare_exp_eq", "__builtin_ppc_compare_exp_eq"); + Builder.defineMacro("__test_data_class", "__builtin_ppc_test_data_class"); } /// PPCTargetInfo::getTargetDefines - Return a set of the PowerPC-specific diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index cd08f5ffe6411..fe532a7d24988 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -16077,6 +16077,17 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID, *this, E, Intrinsic::sqrt, Intrinsic::experimental_constrained_sqrt)) .getScalarVal(); + case PPC::BI__builtin_ppc_test_data_class: +llvm::Type *ArgType = EmitScalarExpr(E->getArg(0))->getType(); +unsigned IntrinsicID; +if (ArgType->isDoubleTy()) + IntrinsicID = Intrinsic::ppc_test_data_class_d; +else if (ArgType->isFloatTy()) + IntrinsicID = Intrinsic::ppc_test_data_class_f; +else + llvm_unreachable("Invalid Argument Type"); +return Builder.CreateCall(CGM.getIntrinsic(IntrinsicID), Ops, + "test_data_class"); } } diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index f2452618c8b16..a6ea2bf2c0f3c 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@
[clang] 3b0240e - [PowerPC] Add range check for vec_genpcvm builtins
Author: Quinn Pham Date: 2021-09-24T11:15:44-05:00 New Revision: 3b0240e6c89d9201430ee83b09fe7c94256e8838 URL: https://github.com/llvm/llvm-project/commit/3b0240e6c89d9201430ee83b09fe7c94256e8838 DIFF: https://github.com/llvm/llvm-project/commit/3b0240e6c89d9201430ee83b09fe7c94256e8838.diff LOG: [PowerPC] Add range check for vec_genpcvm builtins This patch adds range checking for some Power10 altivec builtins. Range checking is done in SemaChecking. Reviewed By: #powerpc, lei, Conanap Differential Revision: https://reviews.llvm.org/D109780 Added: Modified: clang/lib/Sema/SemaChecking.cpp clang/test/CodeGen/builtins-ppc-p10vector-error.c Removed: diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 0310e10f93704..c3c653f6889ed 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -3485,6 +3485,11 @@ bool Sema::CheckPPCBuiltinFunctionCall(const TargetInfo , unsigned BuiltinID, case PPC::BI__builtin_darn_32: return SemaFeatureCheck(*this, TheCall, "isa-v30-instructions", diag::err_ppc_builtin_only_on_arch, "9"); + case PPC::BI__builtin_vsx_xxgenpcvbm: + case PPC::BI__builtin_vsx_xxgenpcvhm: + case PPC::BI__builtin_vsx_xxgenpcvwm: + case PPC::BI__builtin_vsx_xxgenpcvdm: +return SemaBuiltinConstantArgRange(TheCall, 1, 0, 3); #define CUSTOM_BUILTIN(Name, Intr, Types, Acc) \ case PPC::BI__builtin_##Name: \ return SemaBuiltinPPCMMACall(TheCall, Types); diff --git a/clang/test/CodeGen/builtins-ppc-p10vector-error.c b/clang/test/CodeGen/builtins-ppc-p10vector-error.c index e509c5a82c5b0..27d24e3d441c0 100644 --- a/clang/test/CodeGen/builtins-ppc-p10vector-error.c +++ b/clang/test/CodeGen/builtins-ppc-p10vector-error.c @@ -30,3 +30,19 @@ unsigned long long test_vec_cntm_ui(void) { unsigned long long test_vec_cntm_ull(void) { return vec_cntm(vulla, 2); // expected-error 1+ {{argument value 2 is outside the valid range [0, 1]}} } + +vector unsigned char test_xxgenpcvbm(void) { + return vec_genpcvm(vuca, -1); // expected-error 1+ {{argument value -1 is outside the valid range [0, 3]}} +} + +vector unsigned short test_xxgenpcvhm(void) { + return vec_genpcvm(vusa, -1); // expected-error 1+ {{argument value -1 is outside the valid range [0, 3]}} +} + +vector unsigned int test_xxgenpcvwm(void) { + return vec_genpcvm(vuia, 4); // expected-error 1+ {{argument value 4 is outside the valid range [0, 3]}} +} + +vector unsigned long long test_xxgenpcvdm(void) { + return vec_genpcvm(vulla, 4); // expected-error 1+ {{argument value 4 is outside the valid range [0, 3]}} +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] f9912fe - [PowerPC] Add range checks for P10 Vector Builtins
Author: Quinn Pham Date: 2021-09-23T11:05:49-05:00 New Revision: f9912fe4eac91f27965c22d015b3109c5158d050 URL: https://github.com/llvm/llvm-project/commit/f9912fe4eac91f27965c22d015b3109c5158d050 DIFF: https://github.com/llvm/llvm-project/commit/f9912fe4eac91f27965c22d015b3109c5158d050.diff LOG: [PowerPC] Add range checks for P10 Vector Builtins This patch adds range checking for some Power10 altivec builtins and changes the signature of a builtin to match documentation. For `vec_cntm`, range checking is done via SemaChecking. For `vec_splati_ins`, the second argument is masked to extract the 0th bit so that we always receive either a `0` or a `1`. Reviewed By: lei, amyk Differential Revision: https://reviews.llvm.org/D109710 Added: clang/test/CodeGen/builtins-ppc-p10vector-error.c Modified: clang/lib/Headers/altivec.h clang/lib/Sema/SemaChecking.cpp clang/test/CodeGen/builtins-ppc-p10vector.c Removed: diff --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h index 239c93d5b115c..6cfe9815228fa 100644 --- a/clang/lib/Headers/altivec.h +++ b/clang/lib/Headers/altivec.h @@ -18221,13 +18221,13 @@ vec_expandm(vector unsigned __int128 __a) { #define vec_cntm(__a, __mp) \ _Generic((__a), vector unsigned char \ - : __builtin_altivec_vcntmbb((__a), (unsigned int)(__mp)), \ + : __builtin_altivec_vcntmbb((__a), (unsigned char)(__mp)), \ vector unsigned short \ - : __builtin_altivec_vcntmbh((__a), (unsigned int)(__mp)), \ + : __builtin_altivec_vcntmbh((__a), (unsigned char)(__mp)), \ vector unsigned int \ - : __builtin_altivec_vcntmbw((__a), (unsigned int)(__mp)), \ + : __builtin_altivec_vcntmbw((__a), (unsigned char)(__mp)), \ vector unsigned long long \ - : __builtin_altivec_vcntmbd((__a), (unsigned int)(__mp))) + : __builtin_altivec_vcntmbd((__a), (unsigned char)(__mp))) /* vec_gen[b|h|w|d|q]m */ @@ -18756,36 +18756,39 @@ static __inline__ vector double __ATTRS_o_ai vec_splatid(const float __a) { static __inline__ vector signed int __ATTRS_o_ai vec_splati_ins( vector signed int __a, const unsigned int __b, const signed int __c) { + const unsigned int __d = __b & 0x01; #ifdef __LITTLE_ENDIAN__ - __a[1 - __b] = __c; - __a[3 - __b] = __c; + __a[1 - __d] = __c; + __a[3 - __d] = __c; #else - __a[__b] = __c; - __a[2 + __b] = __c; + __a[__d] = __c; + __a[2 + __d] = __c; #endif return __a; } static __inline__ vector unsigned int __ATTRS_o_ai vec_splati_ins( vector unsigned int __a, const unsigned int __b, const unsigned int __c) { + const unsigned int __d = __b & 0x01; #ifdef __LITTLE_ENDIAN__ - __a[1 - __b] = __c; - __a[3 - __b] = __c; + __a[1 - __d] = __c; + __a[3 - __d] = __c; #else - __a[__b] = __c; - __a[2 + __b] = __c; + __a[__d] = __c; + __a[2 + __d] = __c; #endif return __a; } static __inline__ vector float __ATTRS_o_ai vec_splati_ins(vector float __a, const unsigned int __b, const float __c) { + const unsigned int __d = __b & 0x01; #ifdef __LITTLE_ENDIAN__ - __a[1 - __b] = __c; - __a[3 - __b] = __c; + __a[1 - __d] = __c; + __a[3 - __d] = __c; #else - __a[__b] = __c; - __a[2 + __b] = __c; + __a[__d] = __c; + __a[2 + __d] = __c; #endif return __a; } diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 9862306325322..5cc968c133ce3 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -3473,6 +3473,11 @@ bool Sema::CheckPPCBuiltinFunctionCall(const TargetInfo , unsigned BuiltinID, return SemaFeatureCheck(*this, TheCall, "isa-v207-instructions", diag::err_ppc_builtin_only_on_arch, "8") || SemaBuiltinConstantArgRange(TheCall, 1, 1, 16); + case PPC::BI__builtin_altivec_vcntmbb: + case PPC::BI__builtin_altivec_vcntmbh: + case PPC::BI__builtin_altivec_vcntmbw: + case PPC::BI__builtin_altivec_vcntmbd: +return SemaBuiltinConstantArgRange(TheCall, 1, 0, 1); #define CUSTOM_BUILTIN(Name, Intr, Types, Acc) \ case PPC::BI__builtin_##Name: \ return SemaBuiltinPPCMMACall(TheCall, Types); diff --git a/clang/test/CodeGen/builtins-ppc-p10vector-error.c b/clang/test/CodeGen/builtins-ppc-p10vector-error.c new file mode 100644 index 0..e509c5a82c5b0 --- /dev/null +++ b/clang/test/CodeGen/builtins-ppc-p10vector-error.c @@ -0,0 +1,32 @@ +// REQUIRES: powerpc-registered-target +// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-cpu pwr10 \ +// RUN: -fsyntax-only -Wall
[clang] 5793930 - [PowerPC] Fix signature of lxvp and stxvp builtins
Author: Quinn Pham Date: 2021-09-21T11:19:29-05:00 New Revision: 57939309501c33b264b777e04186c7747ebc3de1 URL: https://github.com/llvm/llvm-project/commit/57939309501c33b264b777e04186c7747ebc3de1 DIFF: https://github.com/llvm/llvm-project/commit/57939309501c33b264b777e04186c7747ebc3de1.diff LOG: [PowerPC] Fix signature of lxvp and stxvp builtins This patch changes the signature of the load and store vector pair builtins to match their documentation. The type of the `signed long long` argument is changed to `signed long`. This patch also changes existing testcases to match the signature change. Reviewed By: lei, Conanap Differential Revision: https://reviews.llvm.org/D109996 Added: Modified: clang/include/clang/Basic/BuiltinsPPC.def clang/test/CodeGen/builtins-ppc-pair-mma.c clang/test/Sema/ppc-pair-mma-types.c Removed: diff --git a/clang/include/clang/Basic/BuiltinsPPC.def b/clang/include/clang/Basic/BuiltinsPPC.def index 7a1795d9e550d..f3f8614f21ca0 100644 --- a/clang/include/clang/Basic/BuiltinsPPC.def +++ b/clang/include/clang/Basic/BuiltinsPPC.def @@ -813,8 +813,8 @@ BUILTIN(__builtin_dcbf, "vvC*", "") // its given accumulator. // Provided builtins with _mma_ prefix for compatibility. -CUSTOM_BUILTIN(mma_lxvp, vsx_lxvp, "W256SLLiW256C*", false) -CUSTOM_BUILTIN(mma_stxvp, vsx_stxvp, "vW256SLLiW256C*", false) +CUSTOM_BUILTIN(mma_lxvp, vsx_lxvp, "W256SLiW256C*", false) +CUSTOM_BUILTIN(mma_stxvp, vsx_stxvp, "vW256SLiW256C*", false) CUSTOM_BUILTIN(mma_assemble_pair, vsx_assemble_pair, "vW256*VV", false) CUSTOM_BUILTIN(mma_disassemble_pair, vsx_disassemble_pair, "vv*W256*", false) @@ -823,8 +823,8 @@ CUSTOM_BUILTIN(mma_disassemble_pair, vsx_disassemble_pair, "vv*W256*", false) // ID and INTR are the same. // This avoids repeating the ID and INTR in the macro expression. -UNALIASED_CUSTOM_BUILTIN(vsx_lxvp, "W256SLLiW256C*", false) -UNALIASED_CUSTOM_BUILTIN(vsx_stxvp, "vW256SLLiW256C*", false) +UNALIASED_CUSTOM_BUILTIN(vsx_lxvp, "W256SLiW256C*", false) +UNALIASED_CUSTOM_BUILTIN(vsx_stxvp, "vW256SLiW256C*", false) UNALIASED_CUSTOM_BUILTIN(vsx_assemble_pair, "vW256*VV", false) UNALIASED_CUSTOM_BUILTIN(vsx_disassemble_pair, "vv*W256*", false) diff --git a/clang/test/CodeGen/builtins-ppc-pair-mma.c b/clang/test/CodeGen/builtins-ppc-pair-mma.c index b8dda03498044..ef13348276a64 100644 --- a/clang/test/CodeGen/builtins-ppc-pair-mma.c +++ b/clang/test/CodeGen/builtins-ppc-pair-mma.c @@ -1049,8 +1049,8 @@ void test65(unsigned char *vqp, unsigned char *vpp, vector unsigned char vc, uns // CHECK-NEXT:ret void // void test66(const __vector_pair *vpp, const __vector_pair *vp2) { - __vector_pair vp = __builtin_vsx_lxvp(0LL, vpp); - __builtin_vsx_stxvp(vp, 0LL, vp2); + __vector_pair vp = __builtin_vsx_lxvp(0L, vpp); + __builtin_vsx_stxvp(vp, 0L, vp2); } // CHECK-LABEL: @test67( @@ -1063,7 +1063,7 @@ void test66(const __vector_pair *vpp, const __vector_pair *vp2) { // CHECK-NEXT:tail call void @llvm.ppc.vsx.stxvp(<256 x i1> [[TMP2]], i8* [[TMP4]]) // CHECK-NEXT:ret void // -void test67(const __vector_pair *vpp, signed long long offset, const __vector_pair *vp2) { +void test67(const __vector_pair *vpp, signed long offset, const __vector_pair *vp2) { __vector_pair vp = __builtin_vsx_lxvp(offset, vpp); __builtin_vsx_stxvp(vp, offset, vp2); } @@ -1079,8 +1079,8 @@ void test67(const __vector_pair *vpp, signed long long offset, const __vector_pa // CHECK-NEXT:ret void // void test68(const __vector_pair *vpp, const __vector_pair *vp2) { - __vector_pair vp = __builtin_vsx_lxvp(18LL, vpp); - __builtin_vsx_stxvp(vp, 18LL, vp2); + __vector_pair vp = __builtin_vsx_lxvp(18L, vpp); + __builtin_vsx_stxvp(vp, 18L, vp2); } // CHECK-LABEL: @test69( @@ -1094,8 +1094,8 @@ void test68(const __vector_pair *vpp, const __vector_pair *vp2) { // CHECK-NEXT:ret void // void test69(const __vector_pair *vpp, const __vector_pair *vp2) { - __vector_pair vp = __builtin_vsx_lxvp(1LL, vpp); - __builtin_vsx_stxvp(vp, 1LL, vp2); + __vector_pair vp = __builtin_vsx_lxvp(1L, vpp); + __builtin_vsx_stxvp(vp, 1L, vp2); } // CHECK-LABEL: @test70( @@ -1109,8 +1109,8 @@ void test69(const __vector_pair *vpp, const __vector_pair *vp2) { // CHECK-NEXT:ret void // void test70(const __vector_pair *vpp, const __vector_pair *vp2) { - __vector_pair vp = __builtin_vsx_lxvp(42LL, vpp); - __builtin_vsx_stxvp(vp, 42LL, vp2); + __vector_pair vp = __builtin_vsx_lxvp(42L, vpp); + __builtin_vsx_stxvp(vp, 42L, vp2); } // CHECK-LABEL: @test71( @@ -1124,8 +1124,8 @@ void test70(const __vector_pair *vpp, const __vector_pair *vp2) { // CHECK-NEXT:ret void // void test71(const __vector_pair *vpp, const __vector_pair *vp2) { - __vector_pair vp = __builtin_vsx_lxvp(32768LL, vpp); - __builtin_vsx_stxvp(vp, 32768LL, vp2); + __vector_pair vp =
[clang] e002d25 - [PowerPC] Floating Point Builtins for XL Compat.
Author: Quinn Pham Date: 2021-07-21T08:33:39-05:00 New Revision: e002d251dd34fc1855e3a17feafd358d55d92ed8 URL: https://github.com/llvm/llvm-project/commit/e002d251dd34fc1855e3a17feafd358d55d92ed8 DIFF: https://github.com/llvm/llvm-project/commit/e002d251dd34fc1855e3a17feafd358d55d92ed8.diff LOG: [PowerPC] Floating Point Builtins for XL Compat. This patch is in a series of patches to provide builtins for compatibility with the XL compiler. This patch adds builtins related to floating point operations Reviewed By: #powerpc, nemanjai, amyk, NeHuang Differential Revision: https://reviews.llvm.org/D103986 Added: clang/test/CodeGen/builtins-ppc-xlcompat-fp.c llvm/test/CodeGen/builtins-ppc-xlcompat-fp.ll Modified: clang/include/clang/Basic/BuiltinsPPC.def clang/lib/Basic/Targets/PPC.cpp clang/lib/CodeGen/CGBuiltin.cpp llvm/include/llvm/IR/IntrinsicsPowerPC.td llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp llvm/lib/Target/PowerPC/PPCInstrInfo.td llvm/lib/Target/PowerPC/PPCInstrVSX.td Removed: diff --git a/clang/include/clang/Basic/BuiltinsPPC.def b/clang/include/clang/Basic/BuiltinsPPC.def index 7d46cb96a302..1c68eaf2ec78 100644 --- a/clang/include/clang/Basic/BuiltinsPPC.def +++ b/clang/include/clang/Basic/BuiltinsPPC.def @@ -47,6 +47,21 @@ BUILTIN(__builtin_ppc_dcbt, "vv*", "") BUILTIN(__builtin_ppc_dcbtst, "vv*", "") BUILTIN(__builtin_ppc_dcbz, "vv*", "") BUILTIN(__builtin_ppc_icbt, "vv*", "") +BUILTIN(__builtin_ppc_fric, "dd", "") +BUILTIN(__builtin_ppc_frim, "dd", "") +BUILTIN(__builtin_ppc_frims, "ff", "") +BUILTIN(__builtin_ppc_frin, "dd", "") +BUILTIN(__builtin_ppc_frins, "ff", "") +BUILTIN(__builtin_ppc_frip, "dd", "") +BUILTIN(__builtin_ppc_frips, "ff", "") +BUILTIN(__builtin_ppc_friz, "dd", "") +BUILTIN(__builtin_ppc_frizs, "ff", "") +BUILTIN(__builtin_ppc_fsel, "", "") +BUILTIN(__builtin_ppc_fsels, "", "") +BUILTIN(__builtin_ppc_frsqrte, "dd", "") +BUILTIN(__builtin_ppc_frsqrtes, "ff", "") +BUILTIN(__builtin_ppc_fsqrt, "dd", "") +BUILTIN(__builtin_ppc_fsqrts, "ff", "") BUILTIN(__builtin_ppc_compare_and_swap, "iiD*i*i", "") BUILTIN(__builtin_ppc_compare_and_swaplp, "iLiD*Li*Li", "") BUILTIN(__builtin_ppc_fetch_and_add, "UiUiD*Ui", "") diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp index a8dd6a3fb2ad..86096dc0743b 100644 --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -220,6 +220,21 @@ static void defineXLCompatMacros(MacroBuilder ) { Builder.defineMacro("__mtmsr", "__builtin_ppc_mtmsr"); Builder.defineMacro("__mfspr", "__builtin_ppc_mfspr"); Builder.defineMacro("__mtspr", "__builtin_ppc_mtspr"); + Builder.defineMacro("__fric", "__builtin_ppc_fric"); + Builder.defineMacro("__frim", "__builtin_ppc_frim"); + Builder.defineMacro("__frims", "__builtin_ppc_frims"); + Builder.defineMacro("__frin", "__builtin_ppc_frin"); + Builder.defineMacro("__frins", "__builtin_ppc_frins"); + Builder.defineMacro("__frip", "__builtin_ppc_frip"); + Builder.defineMacro("__frips", "__builtin_ppc_frips"); + Builder.defineMacro("__friz", "__builtin_ppc_friz"); + Builder.defineMacro("__frizs", "__builtin_ppc_frizs"); + Builder.defineMacro("__fsel", "__builtin_ppc_fsel"); + Builder.defineMacro("__fsels", "__builtin_ppc_fsels"); + Builder.defineMacro("__frsqrte", "__builtin_ppc_frsqrte"); + Builder.defineMacro("__frsqrtes", "__builtin_ppc_frsqrtes"); + Builder.defineMacro("__fsqrt", "__builtin_ppc_fsqrt"); + Builder.defineMacro("__fsqrts", "__builtin_ppc_fsqrts"); } /// PPCTargetInfo::getTargetDefines - Return a set of the PowerPC-specific diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 46316d0b295e..cd86433cbf75 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -15726,6 +15726,41 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID, Builder.getFastMathFlags() &= (FMF); return FDiv; } + case PPC::BI__builtin_ppc_fric: +return RValue::get(emitUnaryMaybeConstrainedFPBuiltin( + *this, E, Intrinsic::rint, + Intrinsic::experimental_constrained_rint)) +.getScalarVal(); + case PPC::BI__builtin_ppc_frim: + case PPC::BI__builtin_ppc_frims: +return RValue::get(emitUnaryMaybeConstrainedFPBuiltin( + *this, E, Intrinsic::floor, + Intrinsic::experimental_constrained_floor)) +.getScalarVal(); + case PPC::BI__builtin_ppc_frin: + case PPC::BI__builtin_ppc_frins: +return RValue::get(emitUnaryMaybeConstrainedFPBuiltin( + *this, E, Intrinsic::round, + Intrinsic::experimental_constrained_round)) +.getScalarVal(); + case PPC::BI__builtin_ppc_frip: + case PPC::BI__builtin_ppc_frips: +return