From e3eb3cf5501c6b97b5baa2d66193f2d610492be6 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Fri, 7 Aug 2020 13:04:16 -0700 Subject: [PATCH 01/26] [lldb] Only check for --apple-sdk argument on Darwin --- lldb/packages/Python/lldbsuite/test/dotest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index 10faa67b650877..e6f49749358700 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -426,7 +426,7 @@ def parseOptionsAndInitTestdirs(): configuration.lldb_platform_url = args.lldb_platform_url if args.lldb_platform_working_dir: configuration.lldb_platform_working_dir = args.lldb_platform_working_dir - if args.apple_sdk: + if platform_system == 'Darwin' and args.apple_sdk: configuration.apple_sdk = args.apple_sdk if args.test_build_dir: configuration.test_build_dir = args.test_build_dir From cc01194c2fac5ad400b862463c473f3ef924c932 Mon Sep 17 00:00:00 2001 From: peter klausler Date: Thu, 6 Aug 2020 17:30:01 -0700 Subject: [PATCH 02/26] [flang] Descriptor-based I/O data item transfers Add support for OutputDescriptor() and InputDescriptor() in the I/O runtime. Change existing scalar formatted I/O functions to drive descriptor-based I/O routines internally. Differential Revision: https://reviews.llvm.org/D85491 --- flang/runtime/descriptor-io.h | 354 ++++++++++++++++++++++++++++++++++ flang/runtime/io-api.cpp | 241 ++++++++--------------- flang/runtime/type-code.cpp | 56 ++++++ flang/runtime/type-code.h | 9 +- 4 files changed, 495 insertions(+), 165 deletions(-) create mode 100644 flang/runtime/descriptor-io.h diff --git a/flang/runtime/descriptor-io.h b/flang/runtime/descriptor-io.h new file mode 100644 index 00000000000000..22ae4f9917ab9d --- /dev/null +++ b/flang/runtime/descriptor-io.h @@ -0,0 +1,354 @@ +//===-- runtime/descriptor-io.h ---------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef FORTRAN_RUNTIME_DESCRIPTOR_IO_H_ +#define FORTRAN_RUNTIME_DESCRIPTOR_IO_H_ + +// Implementation of I/O data list item transfers based on descriptors. + +#include "descriptor.h" +#include "edit-input.h" +#include "edit-output.h" +#include "io-stmt.h" +#include "terminator.h" +#include "flang/Common/uint128.h" + +namespace Fortran::runtime::io::descr { +template +inline A &ExtractElement(IoStatementState &io, const Descriptor &descriptor, + const SubscriptValue subscripts[]) { + A *p{descriptor.Element(subscripts)}; + if (!p) { + io.GetIoErrorHandler().Crash("ExtractElement: subscripts out of range"); + } + return *p; +} + +// Per-category descriptor-based I/O templates + +template +inline bool FormattedIntegerIO( + IoStatementState &io, const Descriptor &descriptor) { + std::size_t numElements{descriptor.Elements()}; + SubscriptValue subscripts[maxRank]; + descriptor.GetLowerBounds(subscripts); + for (std::size_t j{0}; j < numElements; ++j) { + if (auto edit{io.GetNextDataEdit()}) { + A &x{ExtractElement(io, descriptor, subscripts)}; + if constexpr (DIR == Direction::Output) { + if (!EditIntegerOutput(io, *edit, static_cast(x))) { + return false; + } + } else if (edit->descriptor != DataEdit::ListDirectedNullValue) { + if (!EditIntegerInput(io, *edit, reinterpret_cast(&x), + static_cast(sizeof(A)))) { + return false; + } + } + if (!descriptor.IncrementSubscripts(subscripts) && j + 1 < numElements) { + io.GetIoErrorHandler().Crash( + "FormattedIntegerIO: subscripts out of bounds"); + } + } else { + return false; + } + } + return true; +} + +template +inline bool FormattedRealIO( + IoStatementState &io, const Descriptor &descriptor) { + std::size_t numElements{descriptor.Elements()}; + SubscriptValue subscripts[maxRank]; + descriptor.GetLowerBounds(subscripts); + for (std::size_t j{0}; j < numElements; ++j) { + if (auto edit{io.GetNextDataEdit()}) { + A &x{ExtractElement(io, descriptor, subscripts)}; + if constexpr (DIR == Direction::Output) { + if (!RealOutputEditing{io, x}.Edit(*edit)) { + return false; + } + } else if (edit->descriptor != DataEdit::ListDirectedNullValue) { + if (!EditRealInput(io, *edit, reinterpret_cast(&x))) { + return false; + } + } + if (!descriptor.IncrementSubscripts(subscripts) && j + 1 < numElements) { + io.GetIoErrorHandler().Crash( + "FormattedRealIO: subscripts out of bounds"); + } + } else { + return false; + } + } + return true; +} + +template +inline bool FormattedComplexIO( + IoStatementState &io, const Descriptor &descriptor) { + std::size_t numElements{descriptor.Elements()}; + SubscriptValue subscripts[maxRank]; + descriptor.GetLowerBounds(subscripts); + bool isListOutput{ + io.get_if>() != nullptr}; + for (std::size_t j{0}; j < numElements; ++j) { + A *x{&ExtractElement(io, descriptor, subscripts)}; + if (isListOutput) { + DataEdit rEdit, iEdit; + rEdit.descriptor = DataEdit::ListDirectedRealPart; + iEdit.descriptor = DataEdit::ListDirectedImaginaryPart; + if (!RealOutputEditing{io, x[0]}.Edit(rEdit) || + !RealOutputEditing{io, x[1]}.Edit(iEdit)) { + return false; + } + } else { + for (int k{0}; k < 2; ++k, ++x) { + auto edit{io.GetNextDataEdit()}; + if (!edit) { + return false; + } else if constexpr (DIR == Direction::Output) { + if (!RealOutputEditing{io, *x}.Edit(*edit)) { + return false; + } + } else if (edit->descriptor == DataEdit::ListDirectedNullValue) { + break; + } else if (!EditRealInput( + io, *edit, reinterpret_cast(x))) { + return false; + } + } + } + if (!descriptor.IncrementSubscripts(subscripts) && j + 1 < numElements) { + io.GetIoErrorHandler().Crash( + "FormattedComplexIO: subscripts out of bounds"); + } + } + return true; +} + +template +inline bool FormattedCharacterIO( + IoStatementState &io, const Descriptor &descriptor) { + std::size_t numElements{descriptor.Elements()}; + SubscriptValue subscripts[maxRank]; + descriptor.GetLowerBounds(subscripts); + std::size_t length{descriptor.ElementBytes() / sizeof(A)}; + auto *listOutput{io.get_if>()}; + for (std::size_t j{0}; j < numElements; ++j) { + A *x{&ExtractElement(io, descriptor, subscripts)}; + if (listOutput) { + if (!ListDirectedDefaultCharacterOutput(io, *listOutput, x, length)) { + return false; + } + } else if (auto edit{io.GetNextDataEdit()}) { + if constexpr (DIR == Direction::Output) { + if (!EditDefaultCharacterOutput(io, *edit, x, length)) { + return false; + } + } else { + if (edit->descriptor != DataEdit::ListDirectedNullValue) { + if (!EditDefaultCharacterInput(io, *edit, x, length)) { + return false; + } + } + } + if (!descriptor.IncrementSubscripts(subscripts) && j + 1 < numElements) { + io.GetIoErrorHandler().Crash( + "FormattedCharacterIO: subscripts out of bounds"); + } + } else { + return false; + } + } + return true; +} + +template +inline bool FormattedLogicalIO( + IoStatementState &io, const Descriptor &descriptor) { + std::size_t numElements{descriptor.Elements()}; + SubscriptValue subscripts[maxRank]; + descriptor.GetLowerBounds(subscripts); + auto *listOutput{io.get_if>()}; + for (std::size_t j{0}; j < numElements; ++j) { + A &x{ExtractElement(io, descriptor, subscripts)}; + if (listOutput) { + if (!ListDirectedLogicalOutput(io, *listOutput, x != 0)) { + return false; + } + } else if (auto edit{io.GetNextDataEdit()}) { + if constexpr (DIR == Direction::Output) { + if (!EditLogicalOutput(io, *edit, x != 0)) { + return false; + } + } else { + if (edit->descriptor != DataEdit::ListDirectedNullValue) { + bool truth{}; + if (EditLogicalInput(io, *edit, truth)) { + x = truth; + } else { + return false; + } + } + } + if (!descriptor.IncrementSubscripts(subscripts) && j + 1 < numElements) { + io.GetIoErrorHandler().Crash( + "FormattedLogicalIO: subscripts out of bounds"); + } + } else { + return false; + } + } + return true; +} + +template +static bool DescriptorIO(IoStatementState &io, const Descriptor &descriptor) { + if (!io.get_if>()) { + io.GetIoErrorHandler().Crash( + "DescriptorIO() called for wrong I/O direction"); + return false; + } + if constexpr (DIR == Direction::Input) { + io.BeginReadingRecord(); + } + if (auto *unf{io.get_if>()}) { + std::size_t elementBytes{descriptor.ElementBytes()}; + SubscriptValue subscripts[maxRank]; + descriptor.GetLowerBounds(subscripts); + if (descriptor.IsContiguous()) { // contiguous unformatted I/O + char &x{ExtractElement(io, descriptor, subscripts)}; + auto totalBytes{descriptor.SizeInBytes()}; + if constexpr (DIR == Direction::Output) { + return unf->Emit(&x, totalBytes, elementBytes); + } else { + return unf->Receive(&x, totalBytes, elementBytes); + } + } else { // non-contiguous unformatted I/O + std::size_t numElements{descriptor.Elements()}; + for (std::size_t j{0}; j < numElements; ++j) { + char &x{ExtractElement(io, descriptor, subscripts)}; + if constexpr (DIR == Direction::Output) { + if (!unf->Emit(&x, elementBytes, elementBytes)) { + return false; + } + } else { + if (!unf->Receive(&x, elementBytes, elementBytes)) { + return false; + } + } + if (!descriptor.IncrementSubscripts(subscripts) && + j + 1 < numElements) { + io.GetIoErrorHandler().Crash( + "DescriptorIO: subscripts out of bounds"); + } + } + return true; + } + } else if (auto catAndKind{descriptor.type().GetCategoryAndKind()}) { + int kind{catAndKind->second}; + switch (catAndKind->first) { + case TypeCategory::Integer: + switch (kind) { + case 1: + return FormattedIntegerIO(io, descriptor); + case 2: + return FormattedIntegerIO(io, descriptor); + case 4: + return FormattedIntegerIO(io, descriptor); + case 8: + return FormattedIntegerIO(io, descriptor); + case 16: + return FormattedIntegerIO(io, descriptor); + default: + io.GetIoErrorHandler().Crash( + "DescriptorIO: Unimplemented INTEGER kind (%d) in descriptor", + kind); + return false; + } + case TypeCategory::Real: + switch (kind) { + case 4: + return FormattedRealIO<24, float, DIR>(io, descriptor); + case 8: + return FormattedRealIO<53, double, DIR>(io, descriptor); +#if __x86_64__ + case 10: + return FormattedRealIO<64, long double, DIR>(io, descriptor); +#else + case 16: + return FormattedRealIO<113, long double, DIR>(io, descriptor); +#endif + // TODO cases 2, 3 + default: + io.GetIoErrorHandler().Crash( + "DescriptorIO: Unimplemented REAL kind (%d) in descriptor", kind); + return false; + } + case TypeCategory::Complex: + switch (kind) { + case 4: + return FormattedComplexIO<24, float, DIR>(io, descriptor); + case 8: + return FormattedComplexIO<53, double, DIR>(io, descriptor); +#if __x86_64__ + case 10: + return FormattedComplexIO<64, long double, DIR>(io, descriptor); +#else + case 16: + return FormattedComplexIO<113, long double, DIR>(io, descriptor); +#endif + // TODO cases 2, 3 + default: + io.GetIoErrorHandler().Crash( + "DescriptorIO: Unimplemented COMPLEX kind (%d) in descriptor", + kind); + return false; + } + case TypeCategory::Character: + switch (kind) { + case 1: + return FormattedCharacterIO(io, descriptor); + // TODO cases 2, 4 + default: + io.GetIoErrorHandler().Crash( + "DescriptorIO: Unimplemented CHARACTER kind (%d) in descriptor", + kind); + return false; + } + case TypeCategory::Logical: + switch (kind) { + case 1: + return FormattedLogicalIO(io, descriptor); + case 2: + return FormattedLogicalIO(io, descriptor); + case 4: + return FormattedLogicalIO(io, descriptor); + case 8: + return FormattedLogicalIO(io, descriptor); + default: + io.GetIoErrorHandler().Crash( + "DescriptorIO: Unimplemented LOGICAL kind (%d) in descriptor", + kind); + return false; + } + case TypeCategory::Derived: + io.GetIoErrorHandler().Crash( + "DescriptorIO: Unimplemented: derived type I/O", + static_cast(descriptor.type().raw())); + return false; + } + } + io.GetIoErrorHandler().Crash("DescriptorIO: Bad type code (%d) in descriptor", + static_cast(descriptor.type().raw())); + return false; +} +} // namespace Fortran::runtime::io::descr +#endif // FORTRAN_RUNTIME_DESCRIPTOR_IO_H_ diff --git a/flang/runtime/io-api.cpp b/flang/runtime/io-api.cpp index f64fe97b2d233e..30f343773f90de 100644 --- a/flang/runtime/io-api.cpp +++ b/flang/runtime/io-api.cpp @@ -9,6 +9,8 @@ // Implements the I/O statement API #include "io-api.h" +#include "descriptor-io.h" +#include "descriptor.h" #include "edit-input.h" #include "edit-output.h" #include "environment.h" @@ -863,15 +865,12 @@ bool IONAME(GetNewUnit)(Cookie cookie, int &unit, int kind) { // Data transfers -bool IONAME(OutputDescriptor)(Cookie cookie, const Descriptor &) { - IoStatementState &io{*cookie}; - io.GetIoErrorHandler().Crash("OutputDescriptor: not yet implemented"); // TODO +bool IONAME(OutputDescriptor)(Cookie cookie, const Descriptor &descriptor) { + return descr::DescriptorIO(*cookie, descriptor); } -bool IONAME(InputDescriptor)(Cookie cookie, const Descriptor &) { - IoStatementState &io{*cookie}; - io.BeginReadingRecord(); - io.GetIoErrorHandler().Crash("InputDescriptor: not yet implemented"); // TODO +bool IONAME(InputDescriptor)(Cookie cookie, const Descriptor &descriptor) { + return descr::DescriptorIO(*cookie, descriptor); } bool IONAME(OutputUnformattedBlock)(Cookie cookie, const char *x, @@ -898,198 +897,112 @@ bool IONAME(InputUnformattedBlock)( } bool IONAME(OutputInteger64)(Cookie cookie, std::int64_t n) { - IoStatementState &io{*cookie}; - if (!io.get_if()) { - io.GetIoErrorHandler().Crash( - "OutputInteger64() called for a non-output I/O statement"); - return false; - } - if (auto edit{io.GetNextDataEdit()}) { - return EditIntegerOutput(io, *edit, n); - } - return false; + StaticDescriptor staticDescriptor; + Descriptor &descriptor{staticDescriptor.descriptor()}; + descriptor.Establish( + TypeCategory::Integer, 8, reinterpret_cast(&n), 0); + return descr::DescriptorIO(*cookie, descriptor); } bool IONAME(InputInteger)(Cookie cookie, std::int64_t &n, int kind) { - IoStatementState &io{*cookie}; - if (!io.get_if()) { - io.GetIoErrorHandler().Crash( - "InputInteger64() called for a non-input I/O statement"); - return false; - } - io.BeginReadingRecord(); - if (auto edit{io.GetNextDataEdit()}) { - if (edit->descriptor == DataEdit::ListDirectedNullValue) { - return true; - } - return EditIntegerInput(io, *edit, reinterpret_cast(&n), kind); - } - return false; -} - -template -static bool OutputReal(Cookie cookie, REAL x) { - IoStatementState &io{*cookie}; - if (!io.get_if()) { - io.GetIoErrorHandler().Crash( - "OutputReal() called for a non-output I/O statement"); - return false; - } - if (auto edit{io.GetNextDataEdit()}) { - return RealOutputEditing{io, x}.Edit(*edit); - } - return false; + StaticDescriptor staticDescriptor; + Descriptor &descriptor{staticDescriptor.descriptor()}; + descriptor.Establish( + TypeCategory::Integer, kind, reinterpret_cast(&n), 0); + return descr::DescriptorIO(*cookie, descriptor); } bool IONAME(OutputReal32)(Cookie cookie, float x) { - return OutputReal<24, float>(cookie, x); + StaticDescriptor staticDescriptor; + Descriptor &descriptor{staticDescriptor.descriptor()}; + descriptor.Establish(TypeCategory::Real, 4, reinterpret_cast(&x), 0); + return descr::DescriptorIO(*cookie, descriptor); } bool IONAME(OutputReal64)(Cookie cookie, double x) { - return OutputReal<53, double>(cookie, x); -} - -template -static bool InputReal(Cookie cookie, REAL &x) { - IoStatementState &io{*cookie}; - if (!io.get_if()) { - io.GetIoErrorHandler().Crash( - "InputReal() called for a non-input I/O statement"); - return false; - } - io.BeginReadingRecord(); - if (auto edit{io.GetNextDataEdit()}) { - if (edit->descriptor == DataEdit::ListDirectedNullValue) { - return true; - } - return EditRealInput(io, *edit, reinterpret_cast(&x)); - } - return false; + StaticDescriptor staticDescriptor; + Descriptor &descriptor{staticDescriptor.descriptor()}; + descriptor.Establish(TypeCategory::Real, 8, reinterpret_cast(&x), 0); + return descr::DescriptorIO(*cookie, descriptor); } bool IONAME(InputReal32)(Cookie cookie, float &x) { - return InputReal<24, float>(cookie, x); + StaticDescriptor staticDescriptor; + Descriptor &descriptor{staticDescriptor.descriptor()}; + descriptor.Establish(TypeCategory::Real, 4, reinterpret_cast(&x), 0); + return descr::DescriptorIO(*cookie, descriptor); } bool IONAME(InputReal64)(Cookie cookie, double &x) { - return InputReal<53, double>(cookie, x); + StaticDescriptor staticDescriptor; + Descriptor &descriptor{staticDescriptor.descriptor()}; + descriptor.Establish(TypeCategory::Real, 8, reinterpret_cast(&x), 0); + return descr::DescriptorIO(*cookie, descriptor); } -template -static bool OutputComplex(Cookie cookie, REAL r, REAL z) { - IoStatementState &io{*cookie}; - if (io.get_if>()) { - DataEdit real, imaginary; - real.descriptor = DataEdit::ListDirectedRealPart; - imaginary.descriptor = DataEdit::ListDirectedImaginaryPart; - return RealOutputEditing{io, r}.Edit(real) && - RealOutputEditing{io, z}.Edit(imaginary); - } - return OutputReal(cookie, r) && OutputReal(cookie, z); +bool IONAME(OutputComplex32)(Cookie cookie, float r, float i) { + float z[2]{r, i}; + StaticDescriptor staticDescriptor; + Descriptor &descriptor{staticDescriptor.descriptor()}; + descriptor.Establish( + TypeCategory::Complex, 4, reinterpret_cast(&z), 0); + return descr::DescriptorIO(*cookie, descriptor); } -bool IONAME(OutputComplex32)(Cookie cookie, float r, float z) { - return OutputComplex<24, float>(cookie, r, z); +bool IONAME(OutputComplex64)(Cookie cookie, double r, double i) { + double z[2]{r, i}; + StaticDescriptor staticDescriptor; + Descriptor &descriptor{staticDescriptor.descriptor()}; + descriptor.Establish( + TypeCategory::Complex, 8, reinterpret_cast(&z), 0); + return descr::DescriptorIO(*cookie, descriptor); } -bool IONAME(OutputComplex64)(Cookie cookie, double r, double z) { - return OutputComplex<53, double>(cookie, r, z); +bool IONAME(InputComplex32)(Cookie cookie, float z[2]) { + StaticDescriptor staticDescriptor; + Descriptor &descriptor{staticDescriptor.descriptor()}; + descriptor.Establish( + TypeCategory::Complex, 4, reinterpret_cast(z), 0); + return descr::DescriptorIO(*cookie, descriptor); } -template -static bool InputComplex(Cookie cookie, REAL x[2]) { - IoStatementState &io{*cookie}; - if (!io.get_if()) { - io.GetIoErrorHandler().Crash( - "InputComplex() called for a non-input I/O statement"); - return false; - } - io.BeginReadingRecord(); - for (int j{0}; j < 2; ++j) { - if (auto edit{io.GetNextDataEdit()}) { - if (edit->descriptor == DataEdit::ListDirectedNullValue) { - return true; - } - if (!EditRealInput(io, *edit, reinterpret_cast(&x[j]))) { - return false; - } - } - } - return true; -} - -bool IONAME(InputComplex32)(Cookie cookie, float x[2]) { - return InputComplex<24, float>(cookie, x); -} - -bool IONAME(InputComplex64)(Cookie cookie, double x[2]) { - return InputComplex<53, double>(cookie, x); +bool IONAME(InputComplex64)(Cookie cookie, double z[2]) { + StaticDescriptor staticDescriptor; + Descriptor &descriptor{staticDescriptor.descriptor()}; + descriptor.Establish( + TypeCategory::Complex, 8, reinterpret_cast(z), 0); + return descr::DescriptorIO(*cookie, descriptor); } bool IONAME(OutputAscii)(Cookie cookie, const char *x, std::size_t length) { - IoStatementState &io{*cookie}; - if (!io.get_if()) { - io.GetIoErrorHandler().Crash( - "OutputAscii() called for a non-output I/O statement"); - return false; - } - if (auto *list{io.get_if>()}) { - return ListDirectedDefaultCharacterOutput(io, *list, x, length); - } else if (auto edit{io.GetNextDataEdit()}) { - return EditDefaultCharacterOutput(io, *edit, x, length); - } else { - return false; - } + StaticDescriptor staticDescriptor; + Descriptor &descriptor{staticDescriptor.descriptor()}; + descriptor.Establish( + 1, length, reinterpret_cast(const_cast(x)), 0); + return descr::DescriptorIO(*cookie, descriptor); } bool IONAME(InputAscii)(Cookie cookie, char *x, std::size_t length) { - IoStatementState &io{*cookie}; - if (!io.get_if()) { - io.GetIoErrorHandler().Crash( - "InputAscii() called for a non-input I/O statement"); - return false; - } - io.BeginReadingRecord(); - if (auto edit{io.GetNextDataEdit()}) { - if (edit->descriptor == DataEdit::ListDirectedNullValue) { - return true; - } - return EditDefaultCharacterInput(io, *edit, x, length); - } - return false; + StaticDescriptor staticDescriptor; + Descriptor &descriptor{staticDescriptor.descriptor()}; + descriptor.Establish(1, length, reinterpret_cast(x), 0); + return descr::DescriptorIO(*cookie, descriptor); } bool IONAME(OutputLogical)(Cookie cookie, bool truth) { - IoStatementState &io{*cookie}; - if (!io.get_if()) { - io.GetIoErrorHandler().Crash( - "OutputLogical() called for a non-output I/O statement"); - return false; - } - if (auto *list{io.get_if>()}) { - return ListDirectedLogicalOutput(io, *list, truth); - } else if (auto edit{io.GetNextDataEdit()}) { - return EditLogicalOutput(io, *edit, truth); - } else { - return false; - } + StaticDescriptor staticDescriptor; + Descriptor &descriptor{staticDescriptor.descriptor()}; + descriptor.Establish( + TypeCategory::Logical, 1, reinterpret_cast(&truth), 0); + return descr::DescriptorIO(*cookie, descriptor); } bool IONAME(InputLogical)(Cookie cookie, bool &truth) { - IoStatementState &io{*cookie}; - if (!io.get_if()) { - io.GetIoErrorHandler().Crash( - "InputLogical() called for a non-input I/O statement"); - return false; - } - io.BeginReadingRecord(); - if (auto edit{io.GetNextDataEdit()}) { - if (edit->descriptor == DataEdit::ListDirectedNullValue) { - return true; - } - return EditLogicalInput(io, *edit, truth); - } - return false; + StaticDescriptor staticDescriptor; + Descriptor &descriptor{staticDescriptor.descriptor()}; + descriptor.Establish( + TypeCategory::Logical, 1, reinterpret_cast(&truth), 0); + return descr::DescriptorIO(*cookie, descriptor); } void IONAME(GetIoMsg)(Cookie cookie, char *msg, std::size_t length) { diff --git a/flang/runtime/type-code.cpp b/flang/runtime/type-code.cpp index 13cc834fd4e9d5..3fda906516eded 100644 --- a/flang/runtime/type-code.cpp +++ b/flang/runtime/type-code.cpp @@ -93,4 +93,60 @@ TypeCode::TypeCode(TypeCategory f, int kind) { break; } } + +std::optional> +TypeCode::GetCategoryAndKind() const { + switch (raw_) { + case CFI_type_int8_t: + return std::make_pair(TypeCategory::Integer, 1); + case CFI_type_int16_t: + return std::make_pair(TypeCategory::Integer, 2); + case CFI_type_int32_t: + return std::make_pair(TypeCategory::Integer, 4); + case CFI_type_int64_t: + return std::make_pair(TypeCategory::Integer, 8); + case CFI_type_int128_t: + return std::make_pair(TypeCategory::Integer, 16); + case CFI_type_float: + return std::make_pair(TypeCategory::Real, 4); + case CFI_type_double: + return std::make_pair(TypeCategory::Real, 8); + case CFI_type_long_double: +#if __x86_64__ + return std::make_pair(TypeCategory::Real, 10); +#else + return std::make_pair(TypeCategory::Real, 16); +#endif + case CFI_type_float_Complex: + return std::make_pair(TypeCategory::Complex, 4); + case CFI_type_double_Complex: + return std::make_pair(TypeCategory::Complex, 8); + case CFI_type_long_double_Complex: +#if __x86_64__ + return std::make_pair(TypeCategory::Complex, 10); +#else + return std::make_pair(TypeCategory::Complex, 16); +#endif + case CFI_type_char: + return std::make_pair(TypeCategory::Character, 1); + case CFI_type_char16_t: + return std::make_pair(TypeCategory::Character, 2); + case CFI_type_char32_t: + return std::make_pair(TypeCategory::Character, 4); + case CFI_type_Bool: + return std::make_pair(TypeCategory::Logical, 1); + case CFI_type_int_fast8_t: + return std::make_pair(TypeCategory::Logical, 1); + case CFI_type_int_fast16_t: + return std::make_pair(TypeCategory::Logical, 2); + case CFI_type_int_fast32_t: + return std::make_pair(TypeCategory::Logical, 4); + case CFI_type_int_fast64_t: + return std::make_pair(TypeCategory::Logical, 8); + case CFI_type_struct: + return std::make_pair(TypeCategory::Derived, 0); + default: + return std::nullopt; + } +} } // namespace Fortran::runtime diff --git a/flang/runtime/type-code.h b/flang/runtime/type-code.h index bda861bf73acf1..9992497445cc29 100644 --- a/flang/runtime/type-code.h +++ b/flang/runtime/type-code.h @@ -11,6 +11,8 @@ #include "flang/Common/Fortran.h" #include "flang/ISO_Fortran_binding.h" +#include +#include namespace Fortran::runtime { @@ -41,10 +43,15 @@ class TypeCode { return raw_ == CFI_type_char || raw_ == CFI_type_char16_t || raw_ == CFI_type_char32_t; } - constexpr bool IsLogical() const { return raw_ == CFI_type_Bool; } + constexpr bool IsLogical() const { + return raw_ == CFI_type_Bool || + (raw_ >= CFI_type_int_fast8_t && raw_ <= CFI_type_int_fast64_t); + } constexpr bool IsDerived() const { return raw_ == CFI_type_struct; } constexpr bool IsIntrinsic() const { return IsValid() && !IsDerived(); } + std::optional> GetCategoryAndKind() const; + private: ISO::CFI_type_t raw_{CFI_type_other}; }; From dc13a9a7813768e01bddd03924d6cac6fa45cd7b Mon Sep 17 00:00:00 2001 From: cgyurgyik Date: Fri, 7 Aug 2020 16:13:48 -0400 Subject: [PATCH 03/26] [libc] Add strcpsn and strpbrk implementation. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D85386 --- libc/config/linux/aarch64/entrypoints.txt | 2 + libc/config/linux/x86_64/entrypoints.txt | 2 + libc/src/string/CMakeLists.txt | 30 +++++++++++ libc/src/string/strcspn.cpp | 20 ++++++++ libc/src/string/strcspn.h | 20 ++++++++ libc/src/string/string_utils.h | 36 +++++++++++++ libc/src/string/strpbrk.cpp | 21 ++++++++ libc/src/string/strpbrk.h | 18 +++++++ libc/src/string/strspn.cpp | 1 - libc/test/src/string/CMakeLists.txt | 19 +++++++ libc/test/src/string/strcspn_test.cpp | 50 ++++++++++++++++++ libc/test/src/string/strpbrk_test.cpp | 62 +++++++++++++++++++++++ 12 files changed, 280 insertions(+), 1 deletion(-) create mode 100644 libc/src/string/strcspn.cpp create mode 100644 libc/src/string/strcspn.h create mode 100644 libc/src/string/string_utils.h create mode 100644 libc/src/string/strpbrk.cpp create mode 100644 libc/src/string/strpbrk.h create mode 100644 libc/test/src/string/strcspn_test.cpp create mode 100644 libc/test/src/string/strpbrk_test.cpp diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt index e1f54bfaa4fd57..aad7819ef55194 100644 --- a/libc/config/linux/aarch64/entrypoints.txt +++ b/libc/config/linux/aarch64/entrypoints.txt @@ -27,8 +27,10 @@ set(TARGET_LIBC_ENTRYPOINTS libc.src.string.strcat libc.src.string.strchr libc.src.string.strcpy + libc.src.string.strcspn libc.src.string.strlen libc.src.string.strnlen + libc.src.string.strpbrk libc.src.string.strrchr libc.src.string.strspn libc.src.string.strstr diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt index db76c351db7f17..ca3a2bd6c47799 100644 --- a/libc/config/linux/x86_64/entrypoints.txt +++ b/libc/config/linux/x86_64/entrypoints.txt @@ -45,8 +45,10 @@ set(TARGET_LIBC_ENTRYPOINTS libc.src.string.strchr libc.src.string.strcmp libc.src.string.strcpy + libc.src.string.strcspn libc.src.string.strlen libc.src.string.strnlen + libc.src.string.strpbrk libc.src.string.strrchr libc.src.string.strspn libc.src.string.strstr diff --git a/libc/src/string/CMakeLists.txt b/libc/src/string/CMakeLists.txt index 82d3457ae340be..b6a15c3f460b55 100644 --- a/libc/src/string/CMakeLists.txt +++ b/libc/src/string/CMakeLists.txt @@ -1,5 +1,13 @@ add_subdirectory(memory_utils) +add_header_library( + string_utils + HDRS + string_utils.h + DEPENDS + libc.utils.CPP.standalone_cpp +) + add_entrypoint_object( strcat SRCS @@ -94,12 +102,34 @@ add_entrypoint_object( strrchr.h ) +add_entrypoint_object( + strcspn + SRCS + strcspn.cpp + HDRS + strcspn.h + DEPENDS + .string_utils +) + add_entrypoint_object( strspn SRCS strspn.cpp HDRS strspn.h + DEPENDS + libc.utils.CPP.standalone_cpp +) + +add_entrypoint_object( + strpbrk + SRCS + strpbrk.cpp + HDRS + strpbrk.h + DEPENDS + .string_utils ) # Helper to define a function with multiple implementations diff --git a/libc/src/string/strcspn.cpp b/libc/src/string/strcspn.cpp new file mode 100644 index 00000000000000..a19b3fb168209d --- /dev/null +++ b/libc/src/string/strcspn.cpp @@ -0,0 +1,20 @@ +//===-- Implementation of strcspn -----------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/string/strcspn.h" + +#include "src/__support/common.h" +#include "src/string/string_utils.h" + +namespace __llvm_libc { + +size_t LLVM_LIBC_ENTRYPOINT(strcspn)(const char *src, const char *segment) { + return internal::complementary_span(src, segment); +} + +} // namespace __llvm_libc diff --git a/libc/src/string/strcspn.h b/libc/src/string/strcspn.h new file mode 100644 index 00000000000000..9674f4b6359b06 --- /dev/null +++ b/libc/src/string/strcspn.h @@ -0,0 +1,20 @@ +//===-- Implementation header for strcspn -----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_STRING_STRCSPN_H +#define LLVM_LIBC_SRC_STRING_STRCSPN_H + +#include + +namespace __llvm_libc { + +size_t strcspn(const char *src, const char *segment); + +} // namespace __llvm_libc + +#endif // LLVM_LIBC_SRC_STRING_STRCSPN_H diff --git a/libc/src/string/string_utils.h b/libc/src/string/string_utils.h new file mode 100644 index 00000000000000..54c1bac9698587 --- /dev/null +++ b/libc/src/string/string_utils.h @@ -0,0 +1,36 @@ +//===-- String utils --------------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LIBC_SRC_STRING_STRING_UTILS_H +#define LIBC_SRC_STRING_STRING_UTILS_H + +#include "src/string/memory_utils/utils.h" + +#include "utils/CPP/Bitset.h" +#include // size_t + +namespace __llvm_libc { +namespace internal { + +// Returns the maximum length span that contains only characters not found in +// 'segment'. If no characters are found, returns the length of 'src'. +static inline size_t complementary_span(const char *src, const char *segment) { + const char *initial = src; + cpp::Bitset<256> bitset; + + for (; *segment; ++segment) + bitset.set(*segment); + for (; *src && !bitset.test(*src); ++src) + ; + return src - initial; +} + +} // namespace internal +} // namespace __llvm_libc + +#endif // LIBC_SRC_STRING_STRING_UTILS_H diff --git a/libc/src/string/strpbrk.cpp b/libc/src/string/strpbrk.cpp new file mode 100644 index 00000000000000..bbd2cec9188f0c --- /dev/null +++ b/libc/src/string/strpbrk.cpp @@ -0,0 +1,21 @@ +//===-- Implementation of strpbrk -----------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/string/strpbrk.h" + +#include "src/__support/common.h" +#include "src/string/string_utils.h" + +namespace __llvm_libc { + +char *LLVM_LIBC_ENTRYPOINT(strpbrk)(const char *src, const char *breakset) { + src += internal::complementary_span(src, breakset); + return *src ? const_cast(src) : nullptr; +} + +} // namespace __llvm_libc diff --git a/libc/src/string/strpbrk.h b/libc/src/string/strpbrk.h new file mode 100644 index 00000000000000..823cd35e9e30e9 --- /dev/null +++ b/libc/src/string/strpbrk.h @@ -0,0 +1,18 @@ +//===-- Implementation header for strpbrk -----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_STRING_STRPBRK_H +#define LLVM_LIBC_SRC_STRING_STRPBRK_H + +namespace __llvm_libc { + +char *strpbrk(const char *src, const char *breakset); + +} // namespace __llvm_libc + +#endif // LLVM_LIBC_SRC_STRING_STRPBRK_H diff --git a/libc/src/string/strspn.cpp b/libc/src/string/strspn.cpp index f01bc01345de77..c85fc8b69ee058 100644 --- a/libc/src/string/strspn.cpp +++ b/libc/src/string/strspn.cpp @@ -11,7 +11,6 @@ #include "src/__support/common.h" #include "utils/CPP/Bitset.h" #include -#include namespace __llvm_libc { diff --git a/libc/test/src/string/CMakeLists.txt b/libc/test/src/string/CMakeLists.txt index e1db8d67becde9..f7c580dd18767f 100644 --- a/libc/test/src/string/CMakeLists.txt +++ b/libc/test/src/string/CMakeLists.txt @@ -102,6 +102,16 @@ add_libc_unittest( libc.src.string.strrchr ) +add_libc_unittest( + strcspn_test + SUITE + libc_string_unittests + SRCS + strcspn_test.cpp + DEPENDS + libc.src.string.strcspn +) + add_libc_unittest( strspn_test SUITE @@ -112,6 +122,15 @@ add_libc_unittest( libc.src.string.strspn ) +add_libc_unittest( + strpbrk_test + SUITE + libc_string_unittests + SRCS + strpbrk_test.cpp + DEPENDS + libc.src.string.strpbrk +) # Tests all implementations that can run on the host. function(add_libc_multi_impl_test name) diff --git a/libc/test/src/string/strcspn_test.cpp b/libc/test/src/string/strcspn_test.cpp new file mode 100644 index 00000000000000..80de495f9623b0 --- /dev/null +++ b/libc/test/src/string/strcspn_test.cpp @@ -0,0 +1,50 @@ +//===-- Unittests for strcspn ---------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/string/strcspn.h" + +#include "utils/UnitTest/Test.h" + +TEST(StrCSpnTest, ComplementarySpanShouldNotGoPastNullTerminator) { + const char src[5] = {'a', 'b', '\0', 'c', 'd'}; + EXPECT_EQ(__llvm_libc::strcspn(src, "b"), size_t{1}); + EXPECT_EQ(__llvm_libc::strcspn(src, "d"), size_t{2}); + + // Same goes for the segment to be searched for. + const char segment[5] = {'1', '2', '\0', '3', '4'}; + EXPECT_EQ(__llvm_libc::strcspn("123", segment), size_t{0}); +} + +TEST(StrCSpnTest, ComplementarySpanForEachIndividualCharacter) { + const char *src = "12345"; + // The complementary span size should increment accordingly. + EXPECT_EQ(__llvm_libc::strcspn(src, "1"), size_t{0}); + EXPECT_EQ(__llvm_libc::strcspn(src, "2"), size_t{1}); + EXPECT_EQ(__llvm_libc::strcspn(src, "3"), size_t{2}); + EXPECT_EQ(__llvm_libc::strcspn(src, "4"), size_t{3}); + EXPECT_EQ(__llvm_libc::strcspn(src, "5"), size_t{4}); +} + +TEST(StrCSpnTest, ComplementarySpanIsStringLengthIfNoCharacterFound) { + // Null terminator. + EXPECT_EQ(__llvm_libc::strcspn("", ""), size_t{0}); + EXPECT_EQ(__llvm_libc::strcspn("", "_"), size_t{0}); + // Single character. + EXPECT_EQ(__llvm_libc::strcspn("a", "b"), size_t{1}); + // Multiple characters. + EXPECT_EQ(__llvm_libc::strcspn("abc", "1"), size_t{3}); +} + +TEST(StrCSpnTest, DuplicatedCharactersNotPartOfComplementarySpan) { + // Complementary span should be zero in all these cases. + EXPECT_EQ(__llvm_libc::strcspn("a", "aa"), size_t{0}); + EXPECT_EQ(__llvm_libc::strcspn("aa", "a"), size_t{0}); + EXPECT_EQ(__llvm_libc::strcspn("aaa", "aa"), size_t{0}); + EXPECT_EQ(__llvm_libc::strcspn("aaaa", "aa"), size_t{0}); + EXPECT_EQ(__llvm_libc::strcspn("aaaa", "baa"), size_t{0}); +} diff --git a/libc/test/src/string/strpbrk_test.cpp b/libc/test/src/string/strpbrk_test.cpp new file mode 100644 index 00000000000000..498e8473a89086 --- /dev/null +++ b/libc/test/src/string/strpbrk_test.cpp @@ -0,0 +1,62 @@ +//===-- Unittests for strpbrk ---------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/string/strpbrk.h" + +#include "utils/UnitTest/Test.h" + +TEST(StrPBrkTest, EmptyStringShouldReturnNullptr) { + // The search should not include the null terminator. + EXPECT_STREQ(__llvm_libc::strpbrk("", ""), nullptr); + EXPECT_STREQ(__llvm_libc::strpbrk("_", ""), nullptr); + EXPECT_STREQ(__llvm_libc::strpbrk("", "_"), nullptr); +} + +TEST(StrPBrkTest, ShouldNotFindAnythingAfterNullTerminator) { + const char src[4] = {'a', 'b', '\0', 'c'}; + EXPECT_STREQ(__llvm_libc::strpbrk(src, "c"), nullptr); +} + +TEST(StrPBrkTest, ShouldReturnNullptrIfNoCharactersFound) { + EXPECT_STREQ(__llvm_libc::strpbrk("12345", "abcdef"), nullptr); +} + +TEST(StrPBrkTest, FindsFirstCharacter) { + const char *src = "12345"; + EXPECT_STREQ(__llvm_libc::strpbrk(src, "1"), "12345"); + EXPECT_STREQ(__llvm_libc::strpbrk(src, "-1"), "12345"); + EXPECT_STREQ(__llvm_libc::strpbrk(src, "1_"), "12345"); + EXPECT_STREQ(__llvm_libc::strpbrk(src, "f1_"), "12345"); + ASSERT_STREQ(src, "12345"); +} + +TEST(StrPBrkTest, FindsMiddleCharacter) { + const char *src = "12345"; + EXPECT_STREQ(__llvm_libc::strpbrk(src, "3"), "345"); + EXPECT_STREQ(__llvm_libc::strpbrk(src, "?3"), "345"); + EXPECT_STREQ(__llvm_libc::strpbrk(src, "3F"), "345"); + EXPECT_STREQ(__llvm_libc::strpbrk(src, "z3_"), "345"); + ASSERT_STREQ(src, "12345"); +} + +TEST(StrPBrkTest, FindsLastCharacter) { + const char *src = "12345"; + EXPECT_STREQ(__llvm_libc::strpbrk(src, "5"), "5"); + EXPECT_STREQ(__llvm_libc::strpbrk(src, "r5"), "5"); + EXPECT_STREQ(__llvm_libc::strpbrk(src, "59"), "5"); + EXPECT_STREQ(__llvm_libc::strpbrk(src, "n5_"), "5"); + ASSERT_STREQ(src, "12345"); +} + +TEST(StrPBrkTest, FindsFirstOfRepeated) { + EXPECT_STREQ(__llvm_libc::strpbrk("A,B,C,D", ","), ",B,C,D"); +} + +TEST(StrPBrkTest, FindsFirstInBreakset) { + EXPECT_STREQ(__llvm_libc::strpbrk("12345", "34"), "345"); +} From 43b304b09f892c305861de3113967c2714ab0d02 Mon Sep 17 00:00:00 2001 From: peter klausler Date: Thu, 6 Aug 2020 17:58:40 -0700 Subject: [PATCH 04/26] [flang] Support DATA statement initialization of numeric with Hollerith/CHARACTER This is a common Fortran language extension. Differential Revision: https://reviews.llvm.org/D85492 --- flang/lib/Semantics/check-data.cpp | 38 +++++++++++++++++++++++++++--- flang/test/Semantics/data06.f90 | 2 +- flang/test/Semantics/data08.f90 | 17 +++++++++++++ 3 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 flang/test/Semantics/data08.f90 diff --git a/flang/lib/Semantics/check-data.cpp b/flang/lib/Semantics/check-data.cpp index 1aa52f06f642f5..49e28ba3a091c2 100644 --- a/flang/lib/Semantics/check-data.cpp +++ b/flang/lib/Semantics/check-data.cpp @@ -287,6 +287,9 @@ class DataInitializationCompiler { bool InitDesignator(const SomeExpr &); // Initializes a single object. bool InitElement(const evaluate::OffsetSymbol &, const SomeExpr &designator); + // If the returned flag is true, emit a warning about CHARACTER misusage. + std::optional> ConvertElement( + const SomeExpr &, const evaluate::DynamicType &); DataInitializations &inits_; evaluate::ExpressionAnalyzer &exprAnalyzer_; @@ -406,6 +409,32 @@ bool DataInitializationCompiler::InitDesignator(const SomeExpr &designator) { return folder.isEmpty(); } +std::optional> +DataInitializationCompiler::ConvertElement( + const SomeExpr &expr, const evaluate::DynamicType &type) { + if (auto converted{evaluate::ConvertToType(type, SomeExpr{expr})}) { + return {std::make_pair(std::move(*converted), false)}; + } + if (std::optional chValue{evaluate::GetScalarConstantValue< + evaluate::Type>(expr)}) { + // Allow DATA initialization with Hollerith and kind=1 CHARACTER like + // (most) other Fortran compilers do. Pad on the right with spaces + // when short, truncate the right if long. + // TODO: big-endian targets + std::size_t bytes{type.MeasureSizeInBytes().value()}; + evaluate::BOZLiteralConstant bits{0}; + for (std::size_t j{0}; j < bytes; ++j) { + char ch{j >= chValue->size() ? ' ' : chValue->at(j)}; + evaluate::BOZLiteralConstant chBOZ{static_cast(ch)}; + bits = bits.IOR(chBOZ.SHIFTL(8 * j)); + } + if (auto converted{evaluate::ConvertToType(type, SomeExpr{bits})}) { + return {std::make_pair(std::move(*converted), true)}; + } + } + return std::nullopt; +} + bool DataInitializationCompiler::InitElement( const evaluate::OffsetSymbol &offsetSymbol, const SomeExpr &designator) { const Symbol &symbol{offsetSymbol.symbol()}; @@ -491,16 +520,19 @@ bool DataInitializationCompiler::InitElement( "Initializer for '%s' must not be a procedure"_err_en_US, DescribeElement()); } else if (auto designatorType{designator.GetType()}) { - if (auto converted{ - evaluate::ConvertToType(*designatorType, SomeExpr{*expr})}) { + if (auto converted{ConvertElement(*expr, *designatorType)}) { // value non-pointer initialization if (std::holds_alternative(expr->u) && designatorType->category() != TypeCategory::Integer) { // 8.6.7(11) exprAnalyzer_.Say(values_.LocateSource(), "BOZ literal should appear in a DATA statement only as a value for an integer object, but '%s' is '%s'"_en_US, DescribeElement(), designatorType->AsFortran()); + } else if (converted->second) { + exprAnalyzer_.context().Say( + "DATA statement value initializes '%s' of type '%s' with CHARACTER"_en_US, + DescribeElement(), designatorType->AsFortran()); } - auto folded{evaluate::Fold(context, std::move(*converted))}; + auto folded{evaluate::Fold(context, std::move(converted->first))}; switch ( GetImage().Add(offsetSymbol.offset(), offsetSymbol.size(), folded)) { case evaluate::InitialImage::Ok: diff --git a/flang/test/Semantics/data06.f90 b/flang/test/Semantics/data06.f90 index c21b99e8e484ac..4743eff3b8b6d5 100644 --- a/flang/test/Semantics/data06.f90 +++ b/flang/test/Semantics/data06.f90 @@ -39,7 +39,7 @@ real function rfunc(x) !ERROR: Initializer for 'rt' must not be a procedure data rt/rfunc/ integer :: jx, jy - !ERROR: DATA statement value could not be converted to the type 'INTEGER(4)' of the object 'jx' + !WARNING: DATA statement value initializes 'jx' of type 'INTEGER(4)' with CHARACTER data jx/'abc'/ !ERROR: DATA statement value could not be converted to the type 'INTEGER(4)' of the object 'jx' data jx/t1()/ diff --git a/flang/test/Semantics/data08.f90 b/flang/test/Semantics/data08.f90 new file mode 100644 index 00000000000000..86a87f90163fc4 --- /dev/null +++ b/flang/test/Semantics/data08.f90 @@ -0,0 +1,17 @@ +! RUN: %f18 -fdebug-dump-symbols -fparse-only %s 2>&1 | FileCheck %s +! CHECK: DATA statement value initializes 'jx' of type 'INTEGER(4)' with CHARACTER +! CHECK: DATA statement value initializes 'jy' of type 'INTEGER(4)' with CHARACTER +! CHECK: DATA statement value initializes 'jz' of type 'INTEGER(4)' with CHARACTER +! CHECK: DATA statement value initializes 'kx' of type 'INTEGER(8)' with CHARACTER +! CHECK: jx (InDataStmt) size=4 offset=0: ObjectEntity type: INTEGER(4) init:1684234849_4 +! CHECK: jy (InDataStmt) size=4 offset=4: ObjectEntity type: INTEGER(4) init:543384161_4 +! CHECK: jz (InDataStmt) size=4 offset=8: ObjectEntity type: INTEGER(4) init:1684234849_4 +! CHECK: kx (InDataStmt) size=8 offset=16: ObjectEntity type: INTEGER(8) init:7523094288207667809_8 + +integer :: jx, jy, jz +integer(8) :: kx +data jx/4habcd/ +data jy/3habc/ +data jz/5habcde/ +data kx/'abcdefgh'/ +end From d6c00edf2eb8e6b1289d684e9f0fd1b576f081d6 Mon Sep 17 00:00:00 2001 From: Sameer Arora Date: Mon, 13 Jul 2020 07:39:29 -0700 Subject: [PATCH 05/26] [FileCheck] Add docs for --allow-empty This diff adds documentation for `allow-empty` flag under FileCheck docs. Reviewed by jhenderson, smeenai, thopre Differential Revision: https://reviews.llvm.org/D83682 --- llvm/docs/CommandGuide/FileCheck.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/llvm/docs/CommandGuide/FileCheck.rst b/llvm/docs/CommandGuide/FileCheck.rst index a7645fc9f7fd20..80c48534959e87 100644 --- a/llvm/docs/CommandGuide/FileCheck.rst +++ b/llvm/docs/CommandGuide/FileCheck.rst @@ -181,6 +181,10 @@ and from the command line. as old tests are migrated to the new non-overlapping ``CHECK-DAG:`` implementation. +.. option:: --allow-empty + + Allow checking empty input. By default, empty input is rejected. + .. option:: --color Use colors in output (autodetected by default). @@ -903,5 +907,5 @@ matches output of the form (from llvm-dwarfdump): DW_AT_location [DW_FORM_sec_offset] (0x00000233) DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000c9] = "intd") -letting us set the :program:`FileCheck` variable ``DLOC`` to the desired value +letting us set the :program:`FileCheck` variable ``DLOC`` to the desired value ``0x00000233``, extracted from the line immediately preceding "``intd``". From 968cba8e89f7226f325b04278d3b5dff7d4ebc36 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Fri, 7 Aug 2020 13:28:05 -0700 Subject: [PATCH 06/26] lldbutil: add a retry mechanism for the ios simulator We've been seeing this failure on green dragon when the system is under high load. Unfortunately this is outside of LLDB's control. Differential Revision: https://reviews.llvm.org/D85542 --- lldb/packages/Python/lldbsuite/test/lldbutil.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index 1b366f295540fb..4eb407638903ae 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -21,6 +21,8 @@ import lldb from . import lldbtest_config +# How often failed simulator process launches are retried. +SIMULATOR_RETRY = 3 # =================================================== # Utilities for locating/checking executable programs @@ -818,9 +820,20 @@ def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None, error = lldb.SBError() process = target.Launch(launch_info, error) + # Unfortunate workaround for the iPhone simulator. + retry = SIMULATOR_RETRY + while (retry and error.Fail() and error.GetCString() and + "Unable to boot the Simulator" in error.GetCString()): + retry -= 1 + print("** Simulator is unresponsive. Retrying %d more time(s)"%retry) + import time + time.sleep(60) + error = lldb.SBError() + process = target.Launch(launch_info, error) + test.assertTrue(process, - "Could not create a valid process for %s: %s"%(target.GetExecutable().GetFilename(), - error.GetCString())) + "Could not create a valid process for %s: %s" % + (target.GetExecutable().GetFilename(), error.GetCString())) test.assertFalse(error.Fail(), "Process launch failed: %s" % (error.GetCString())) From 5a0b1472c0e4e08071c688d03800f1b54983187d Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Fri, 7 Aug 2020 09:08:00 -0400 Subject: [PATCH 07/26] GlobalISel: Handle zext(sext x) in artifact combiner This eliminates the illegal intermediate s8 value in the added test. --- .../GlobalISel/LegalizationArtifactCombiner.h | 16 +- .../GlobalISel/artifact-combiner-zext.mir | 162 ++++++++++++++++++ 2 files changed, 172 insertions(+), 6 deletions(-) diff --git a/llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h b/llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h index 016b0bacab8527..6c6f82ee486133 100644 --- a/llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h +++ b/llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h @@ -105,19 +105,23 @@ class LegalizationArtifactCombiner { Register SrcReg = lookThroughCopyInstrs(MI.getOperand(1).getReg()); // zext(trunc x) - > and (aext/copy/trunc x), mask + // zext(sext x) -> and (sext x), mask Register TruncSrc; - if (mi_match(SrcReg, MRI, m_GTrunc(m_Reg(TruncSrc)))) { + Register SextSrc; + if (mi_match(SrcReg, MRI, m_GTrunc(m_Reg(TruncSrc))) || + mi_match(SrcReg, MRI, m_GSExt(m_Reg(SextSrc)))) { LLT DstTy = MRI.getType(DstReg); if (isInstUnsupported({TargetOpcode::G_AND, {DstTy}}) || isConstantUnsupported(DstTy)) return false; LLVM_DEBUG(dbgs() << ".. Combine MI: " << MI;); LLT SrcTy = MRI.getType(SrcReg); - APInt Mask = APInt::getAllOnesValue(SrcTy.getScalarSizeInBits()); - auto MIBMask = Builder.buildConstant( - DstTy, Mask.zext(DstTy.getScalarSizeInBits())); - Builder.buildAnd(DstReg, Builder.buildAnyExtOrTrunc(DstTy, TruncSrc), - MIBMask); + APInt MaskVal = APInt::getAllOnesValue(SrcTy.getScalarSizeInBits()); + auto Mask = Builder.buildConstant( + DstTy, MaskVal.zext(DstTy.getScalarSizeInBits())); + auto Extended = SextSrc ? Builder.buildSExtOrTrunc(DstTy, SextSrc) : + Builder.buildAnyExtOrTrunc(DstTy, TruncSrc); + Builder.buildAnd(DstReg, Extended, Mask); markInstAndDefDead(MI, *MRI.getVRegDef(SrcReg), DeadInsts); return true; } diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/artifact-combiner-zext.mir b/llvm/test/CodeGen/AMDGPU/GlobalISel/artifact-combiner-zext.mir index 85e7106675d755..4552b5f5ef53c1 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/artifact-combiner-zext.mir +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/artifact-combiner-zext.mir @@ -117,3 +117,165 @@ body: | %4:_(s128) = G_ZEXT %3 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %4 ... + +--- +name: test_zext_s8_to_s32_of_sext_s1_to_s8 +body: | + bb.0: + liveins: $vgpr0, $vgpr1 + + ; CHECK-LABEL: name: test_zext_s8_to_s32_of_sext_s1_to_s8 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 + ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1 + ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY1]] + ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 + ; CHECK: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[ICMP]](s1) + ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[SEXT]], [[C]] + ; CHECK: $vgpr0 = COPY [[AND]](s32) + %0:_(s32) = COPY $vgpr0 + %1:_(s32) = COPY $vgpr1 + %2:_(s1) = G_ICMP intpred(eq), %0, %1 + %3:_(s8) = G_SEXT %2 + %4:_(s32) = G_ZEXT %3 + $vgpr0 = COPY %4 +... + +--- +name: test_zext_s8_to_s32_of_sext_s1_to_s16 +body: | + bb.0: + liveins: $vgpr0, $vgpr1 + + ; CHECK-LABEL: name: test_zext_s8_to_s32_of_sext_s1_to_s16 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 + ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1 + ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY1]] + ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[ICMP]](s1) + ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[SEXT]], [[C]] + ; CHECK: $vgpr0 = COPY [[AND]](s32) + %0:_(s32) = COPY $vgpr0 + %1:_(s32) = COPY $vgpr1 + %2:_(s1) = G_ICMP intpred(eq), %0, %1 + %3:_(s16) = G_SEXT %2 + %4:_(s32) = G_ZEXT %3 + $vgpr0 = COPY %4 +... + +--- +name: test_zext_s8_to_s32_of_sext_s8_to_s16 +body: | + bb.0: + liveins: $vgpr0_vgpr1 + + ; CHECK-LABEL: name: test_zext_s8_to_s32_of_sext_s8_to_s16 + ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 + ; CHECK: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (load 1, addrspace 1) + ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[LOAD]](s32) + ; CHECK: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 8 + ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[SEXT_INREG]], [[C]] + ; CHECK: $vgpr0 = COPY [[AND]](s32) + %0:_(p1) = COPY $vgpr0_vgpr1 + %1:_(s8) = G_LOAD %0 :: (load 1, addrspace 1) + %2:_(s16) = G_SEXT %1 + %3:_(s32) = G_ZEXT %2 + $vgpr0 = COPY %3 +... + +--- +name: test_zext_v2s8_to_v2s32_of_sext_v2s1_to_v2s8 +body: | + bb.0: + liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 + + ; CHECK-LABEL: name: test_zext_v2s8_to_v2s32_of_sext_v2s1_to_v2s8 + ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1 + ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr2_vgpr3 + ; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>) + ; CHECK: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY1]](<2 x s32>) + ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[UV]](s32), [[UV2]] + ; CHECK: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[UV1]](s32), [[UV3]] + ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP]](s1) + ; CHECK: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP1]](s1) + ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 + ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32) + ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ANYEXT]](s32) + ; CHECK: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY2]], 1 + ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[ANYEXT1]](s32) + ; CHECK: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY3]], 1 + ; CHECK: [[BUILD_VECTOR1:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[SEXT_INREG]](s32), [[SEXT_INREG1]](s32) + ; CHECK: [[AND:%[0-9]+]]:_(<2 x s32>) = G_AND [[BUILD_VECTOR1]], [[BUILD_VECTOR]] + ; CHECK: $vgpr0_vgpr1 = COPY [[AND]](<2 x s32>) + %0:_(<2 x s32>) = COPY $vgpr0_vgpr1 + %1:_(<2 x s32>) = COPY $vgpr2_vgpr3 + %2:_(<2 x s1>) = G_ICMP intpred(eq), %0, %1 + %3:_(<2 x s8>) = G_SEXT %2 + %4:_(<2 x s32>) = G_ZEXT %3 + $vgpr0_vgpr1 = COPY %4 +... + +--- +name: test_zext_v2s8_to_v2s32_of_sext_v2s1_to_v2s16 +body: | + bb.0: + liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 + + ; CHECK-LABEL: name: test_zext_v2s8_to_v2s32_of_sext_v2s1_to_v2s16 + ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1 + ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr2_vgpr3 + ; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>) + ; CHECK: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY1]](<2 x s32>) + ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[UV]](s32), [[UV2]] + ; CHECK: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[UV1]](s32), [[UV3]] + ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP]](s1) + ; CHECK: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP1]](s1) + ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32) + ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ANYEXT]](s32) + ; CHECK: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY2]], 1 + ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[ANYEXT1]](s32) + ; CHECK: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY3]], 1 + ; CHECK: [[BUILD_VECTOR1:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[SEXT_INREG]](s32), [[SEXT_INREG1]](s32) + ; CHECK: [[AND:%[0-9]+]]:_(<2 x s32>) = G_AND [[BUILD_VECTOR1]], [[BUILD_VECTOR]] + ; CHECK: $vgpr0_vgpr1 = COPY [[AND]](<2 x s32>) + %0:_(<2 x s32>) = COPY $vgpr0_vgpr1 + %1:_(<2 x s32>) = COPY $vgpr2_vgpr3 + %2:_(<2 x s1>) = G_ICMP intpred(eq), %0, %1 + %3:_(<2 x s16>) = G_SEXT %2 + %4:_(<2 x s32>) = G_ZEXT %3 + $vgpr0_vgpr1 = COPY %4 +... + +--- +name: test_zext_v2s8_to_v2s32_of_sext_v2s8_to_v2s16 +body: | + bb.0: + liveins: $vgpr0_vgpr1 + + ; CHECK-LABEL: name: test_zext_v2s8_to_v2s32_of_sext_v2s8_to_v2s16 + ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 + ; CHECK: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (load 2, addrspace 1) + ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 8 + ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[LOAD]], [[C]](s32) + ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 + ; CHECK: [[LSHR1:%[0-9]+]]:_(s32) = G_LSHR [[LOAD]], [[C1]](s32) + ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 24 + ; CHECK: [[LSHR2:%[0-9]+]]:_(s32) = G_LSHR [[LOAD]], [[C2]](s32) + ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[LOAD]](s32) + ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32) + ; CHECK: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 + ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[C3]](s32), [[C3]](s32) + ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32) + ; CHECK: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY3]], 8 + ; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32) + ; CHECK: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY4]], 8 + ; CHECK: [[BUILD_VECTOR1:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[SEXT_INREG]](s32), [[SEXT_INREG1]](s32) + ; CHECK: [[AND:%[0-9]+]]:_(<2 x s32>) = G_AND [[BUILD_VECTOR1]], [[BUILD_VECTOR]] + ; CHECK: $vgpr0_vgpr1 = COPY [[AND]](<2 x s32>) + %0:_(p1) = COPY $vgpr0_vgpr1 + %1:_(<2 x s8>) = G_LOAD %0 :: (load 2, addrspace 1) + %2:_(<2 x s16>) = G_SEXT %1 + %3:_(<2 x s32>) = G_ZEXT %2 + $vgpr0_vgpr1 = COPY %3 +... From 164a02d0fa461c623446bb5e3ee15516bcfad13c Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 7 Aug 2020 13:42:09 -0700 Subject: [PATCH 08/26] [ELF]: --icf: don't fold sections referencing sections with LCDA after D84610 --- lld/ELF/ICF.cpp | 3 ++- lld/test/ELF/icf-eh-frame.s | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lld/ELF/ICF.cpp b/lld/ELF/ICF.cpp index c9d922f558dcbc..f3c477c1d2c222 100644 --- a/lld/ELF/ICF.cpp +++ b/lld/ELF/ICF.cpp @@ -468,9 +468,10 @@ template void ICF::run() { // // If two .gcc_except_table have identical semantics (usually identical // content with PC-relative encoding), we will lose folding opportunity. + uint32_t uniqueId = 0; for (Partition &part : partitions) part.ehFrame->iterateFDEWithLSDA( - [&](InputSection &s) { s.eqClass[0] = 1; }); + [&](InputSection &s) { s.eqClass[0] = ++uniqueId; }); // Collect sections to merge. for (InputSectionBase *sec : inputSections) { diff --git a/lld/test/ELF/icf-eh-frame.s b/lld/test/ELF/icf-eh-frame.s index e90df5f96d9f6f..0b895ec8cc2cce 100644 --- a/lld/test/ELF/icf-eh-frame.s +++ b/lld/test/ELF/icf-eh-frame.s @@ -41,3 +41,10 @@ _Z1dv: .section .gcc_except_table,"a",@progbits ## The actual content does not matter. .Lexception0: + +## .rodata.Z1[ab]v reference .text.Z1[ab]v. Dont fold them. +.section .rodata.Z1av,"a",@progbits + .long .text.Z1av - . + +.section .rodata.Z1bv,"a",@progbits + .long .text.Z1bv - . From 86646be3158933330bf3342e9d7e4250945bb70c Mon Sep 17 00:00:00 2001 From: River Riddle Date: Fri, 7 Aug 2020 13:29:11 -0700 Subject: [PATCH 09/26] [mlir] Refactor StorageUniquer to require registration of possible storage types This allows for bucketing the different possible storage types, with each bucket having its own allocator/mutex/instance map. This greatly reduces the amount of lock contention when multi-threading is enabled. On some non-trivial .mlir modules (>300K operations), this led to a compile time decrease of a single conversion pass by around half a second(>25%). Differential Revision: https://reviews.llvm.org/D82596 --- mlir/include/mlir/Dialect/SDBM/SDBMDialect.h | 3 +- mlir/include/mlir/IR/AttributeSupport.h | 8 +- mlir/include/mlir/IR/StorageUniquerSupport.h | 4 +- mlir/include/mlir/IR/TypeSupport.h | 8 +- mlir/include/mlir/Support/StorageUniquer.h | 43 ++-- mlir/lib/Dialect/SDBM/SDBMDialect.cpp | 10 + mlir/lib/Dialect/SDBM/SDBMExpr.cpp | 13 +- mlir/lib/IR/AffineExpr.cpp | 12 +- mlir/lib/IR/MLIRContext.cpp | 9 + mlir/lib/Support/StorageUniquer.cpp | 207 +++++++++++-------- 10 files changed, 202 insertions(+), 115 deletions(-) diff --git a/mlir/include/mlir/Dialect/SDBM/SDBMDialect.h b/mlir/include/mlir/Dialect/SDBM/SDBMDialect.h index 901ada94482f38..85cfe91d2c9b98 100644 --- a/mlir/include/mlir/Dialect/SDBM/SDBMDialect.h +++ b/mlir/include/mlir/Dialect/SDBM/SDBMDialect.h @@ -17,8 +17,7 @@ class MLIRContext; class SDBMDialect : public Dialect { public: - SDBMDialect(MLIRContext *context) - : Dialect(getDialectNamespace(), context, TypeID::get()) {} + SDBMDialect(MLIRContext *context); /// Since there are no other virtual methods in this derived class, override /// the destructor so that key methods get defined in the corresponding diff --git a/mlir/include/mlir/IR/AttributeSupport.h b/mlir/include/mlir/IR/AttributeSupport.h index 72a89be4386739..79ce1dd2db9542 100644 --- a/mlir/include/mlir/IR/AttributeSupport.h +++ b/mlir/include/mlir/IR/AttributeSupport.h @@ -133,17 +133,19 @@ class AttributeUniquer { template static T get(MLIRContext *ctx, unsigned kind, Args &&... args) { return ctx->getAttributeUniquer().get( + T::getTypeID(), [ctx](AttributeStorage *storage) { initializeAttributeStorage(storage, ctx, T::getTypeID()); }, kind, std::forward(args)...); } - template - static LogicalResult mutate(MLIRContext *ctx, ImplType *impl, + template + static LogicalResult mutate(MLIRContext *ctx, typename T::ImplType *impl, Args &&...args) { assert(impl && "cannot mutate null attribute"); - return ctx->getAttributeUniquer().mutate(impl, std::forward(args)...); + return ctx->getAttributeUniquer().mutate(T::getTypeID(), impl, + std::forward(args)...); } private: diff --git a/mlir/include/mlir/IR/StorageUniquerSupport.h b/mlir/include/mlir/IR/StorageUniquerSupport.h index 4c7693c28d2fd0..707d4d7f9ad658 100644 --- a/mlir/include/mlir/IR/StorageUniquerSupport.h +++ b/mlir/include/mlir/IR/StorageUniquerSupport.h @@ -109,8 +109,8 @@ class StorageUserBase : public BaseT, public Traits... { /// The arguments are forwarded to 'ConcreteT::mutate'. template LogicalResult mutate(Args &&...args) { - return UniquerT::mutate(this->getContext(), getImpl(), - std::forward(args)...); + return UniquerT::template mutate(this->getContext(), getImpl(), + std::forward(args)...); } /// Default implementation that just returns success. diff --git a/mlir/include/mlir/IR/TypeSupport.h b/mlir/include/mlir/IR/TypeSupport.h index ddb91e09dc89a4..0e1a6c72c11d96 100644 --- a/mlir/include/mlir/IR/TypeSupport.h +++ b/mlir/include/mlir/IR/TypeSupport.h @@ -127,6 +127,7 @@ struct TypeUniquer { template static T get(MLIRContext *ctx, unsigned kind, Args &&... args) { return ctx->getTypeUniquer().get( + T::getTypeID(), [&](TypeStorage *storage) { storage->initialize(AbstractType::lookup(T::getTypeID(), ctx)); }, @@ -135,11 +136,12 @@ struct TypeUniquer { /// Change the mutable component of the given type instance in the provided /// context. - template - static LogicalResult mutate(MLIRContext *ctx, ImplType *impl, + template + static LogicalResult mutate(MLIRContext *ctx, typename T::ImplType *impl, Args &&...args) { assert(impl && "cannot mutate null type"); - return ctx->getTypeUniquer().mutate(impl, std::forward(args)...); + return ctx->getTypeUniquer().mutate(T::getTypeID(), impl, + std::forward(args)...); } }; } // namespace detail diff --git a/mlir/include/mlir/Support/StorageUniquer.h b/mlir/include/mlir/Support/StorageUniquer.h index 3100b4454197ba..6c7c7b0496da7c 100644 --- a/mlir/include/mlir/Support/StorageUniquer.h +++ b/mlir/include/mlir/Support/StorageUniquer.h @@ -15,6 +15,8 @@ #include "llvm/Support/Allocator.h" namespace mlir { +class TypeID; + namespace detail { struct StorageUniquerImpl; @@ -75,6 +77,10 @@ using has_impltype_hash_t = decltype(ImplTy::hashKey(std::declval())); /// value of the function is used to indicate whether the mutation was /// successful, e.g., to limit the number of mutations or enable deferred /// one-time assignment of the mutable component. +/// +/// All storage classes must be registered with the uniquer via +/// `registerStorageType` using an appropriate unique `TypeID` for the storage +/// class. class StorageUniquer { public: StorageUniquer(); @@ -83,6 +89,10 @@ class StorageUniquer { /// Set the flag specifying if multi-threading is disabled within the uniquer. void disableMultithreading(bool disable = true); + /// Register a new storage object with this uniquer using the given unique + /// type id. + void registerStorageType(TypeID id); + /// This class acts as the base storage that all storage classes must derived /// from. class BaseStorage { @@ -140,8 +150,8 @@ class StorageUniquer { /// function is used for derived types that have complex storage or uniquing /// constraints. template - Storage *get(function_ref initFn, unsigned kind, Arg &&arg, - Args &&... args) { + Storage *get(const TypeID &id, function_ref initFn, + unsigned kind, Arg &&arg, Args &&...args) { // Construct a value of the derived key type. auto derivedKey = getKey(std::forward(arg), std::forward(args)...); @@ -163,7 +173,8 @@ class StorageUniquer { }; // Get an instance for the derived storage. - return static_cast(getImpl(kind, hashValue, isEqual, ctorFn)); + return static_cast( + getImpl(id, kind, hashValue, isEqual, ctorFn)); } /// Gets a uniqued instance of 'Storage'. 'initFn' is an optional parameter @@ -171,31 +182,32 @@ class StorageUniquer { /// function is used for derived types that use no additional storage or /// uniquing outside of the kind. template - Storage *get(function_ref initFn, unsigned kind) { + Storage *get(const TypeID &id, function_ref initFn, + unsigned kind) { auto ctorFn = [&](StorageAllocator &allocator) { auto *storage = new (allocator.allocate()) Storage(); if (initFn) initFn(storage); return storage; }; - return static_cast(getImpl(kind, ctorFn)); + return static_cast(getImpl(id, kind, ctorFn)); } /// Changes the mutable component of 'storage' by forwarding the trailing /// arguments to the 'mutate' function of the derived class. template - LogicalResult mutate(Storage *storage, Args &&...args) { + LogicalResult mutate(const TypeID &id, Storage *storage, Args &&...args) { auto mutationFn = [&](StorageAllocator &allocator) -> LogicalResult { return static_cast(*storage).mutate( allocator, std::forward(args)...); }; - return mutateImpl(mutationFn); + return mutateImpl(id, mutationFn); } /// Erases a uniqued instance of 'Storage'. This function is used for derived /// types that have complex storage or uniquing constraints. template - void erase(unsigned kind, Arg &&arg, Args &&... args) { + void erase(const TypeID &id, unsigned kind, Arg &&arg, Args &&...args) { // Construct a value of the derived key type. auto derivedKey = getKey(std::forward(arg), std::forward(args)...); @@ -209,7 +221,7 @@ class StorageUniquer { }; // Attempt to erase the storage instance. - eraseImpl(kind, hashValue, isEqual, [](BaseStorage *storage) { + eraseImpl(id, kind, hashValue, isEqual, [](BaseStorage *storage) { static_cast(storage)->cleanup(); }); } @@ -217,24 +229,25 @@ class StorageUniquer { private: /// Implementation for getting/creating an instance of a derived type with /// complex storage. - BaseStorage *getImpl(unsigned kind, unsigned hashValue, + BaseStorage *getImpl(const TypeID &id, unsigned kind, unsigned hashValue, function_ref isEqual, function_ref ctorFn); /// Implementation for getting/creating an instance of a derived type with /// default storage. - BaseStorage *getImpl(unsigned kind, + BaseStorage *getImpl(const TypeID &id, unsigned kind, function_ref ctorFn); /// Implementation for erasing an instance of a derived type with complex /// storage. - void eraseImpl(unsigned kind, unsigned hashValue, + void eraseImpl(const TypeID &id, unsigned kind, unsigned hashValue, function_ref isEqual, function_ref cleanupFn); /// Implementation for mutating an instance of a derived storage. LogicalResult - mutateImpl(function_ref mutationFn); + mutateImpl(const TypeID &id, + function_ref mutationFn); /// The internal implementation class. std::unique_ptr impl; @@ -249,7 +262,7 @@ class StorageUniquer { static typename std::enable_if< llvm::is_detected::value, typename ImplTy::KeyTy>::type - getKey(Args &&... args) { + getKey(Args &&...args) { return ImplTy::getKey(args...); } /// If there is no 'ImplTy::getKey' method, then we try to directly construct @@ -258,7 +271,7 @@ class StorageUniquer { static typename std::enable_if< !llvm::is_detected::value, typename ImplTy::KeyTy>::type - getKey(Args &&... args) { + getKey(Args &&...args) { return typename ImplTy::KeyTy(args...); } diff --git a/mlir/lib/Dialect/SDBM/SDBMDialect.cpp b/mlir/lib/Dialect/SDBM/SDBMDialect.cpp index 6306063181b3f0..09c9d1dfd3d83f 100644 --- a/mlir/lib/Dialect/SDBM/SDBMDialect.cpp +++ b/mlir/lib/Dialect/SDBM/SDBMDialect.cpp @@ -7,7 +7,17 @@ //===----------------------------------------------------------------------===// #include "mlir/Dialect/SDBM/SDBMDialect.h" +#include "SDBMExprDetail.h" using namespace mlir; +SDBMDialect::SDBMDialect(MLIRContext *context) + : Dialect(getDialectNamespace(), context, TypeID::get()) { + uniquer.registerStorageType(TypeID::get()); + uniquer.registerStorageType(TypeID::get()); + uniquer.registerStorageType(TypeID::get()); + uniquer.registerStorageType(TypeID::get()); + uniquer.registerStorageType(TypeID::get()); +} + SDBMDialect::~SDBMDialect() = default; diff --git a/mlir/lib/Dialect/SDBM/SDBMExpr.cpp b/mlir/lib/Dialect/SDBM/SDBMExpr.cpp index 5d60158c34e4b8..435c7fe25f0c90 100644 --- a/mlir/lib/Dialect/SDBM/SDBMExpr.cpp +++ b/mlir/lib/Dialect/SDBM/SDBMExpr.cpp @@ -246,6 +246,7 @@ SDBMSumExpr SDBMSumExpr::get(SDBMTermExpr lhs, SDBMConstantExpr rhs) { StorageUniquer &uniquer = lhs.getDialect()->getUniquer(); return uniquer.get( + TypeID::get(), /*initFn=*/{}, static_cast(SDBMExprKind::Add), lhs, rhs); } @@ -533,6 +534,7 @@ SDBMDiffExpr SDBMDiffExpr::get(SDBMDirectExpr lhs, SDBMTermExpr rhs) { StorageUniquer &uniquer = lhs.getDialect()->getUniquer(); return uniquer.get( + TypeID::get(), /*initFn=*/{}, static_cast(SDBMExprKind::Diff), lhs, rhs); } @@ -573,6 +575,7 @@ SDBMStripeExpr SDBMStripeExpr::get(SDBMDirectExpr var, StorageUniquer &uniquer = var.getDialect()->getUniquer(); return uniquer.get( + TypeID::get(), /*initFn=*/{}, static_cast(SDBMExprKind::Stripe), var, stripeFactor); } @@ -608,7 +611,8 @@ SDBMDimExpr SDBMDimExpr::get(SDBMDialect *dialect, unsigned position) { StorageUniquer &uniquer = dialect->getUniquer(); return uniquer.get( - assignDialect, static_cast(SDBMExprKind::DimId), position); + TypeID::get(), assignDialect, + static_cast(SDBMExprKind::DimId), position); } //===----------------------------------------------------------------------===// @@ -624,7 +628,8 @@ SDBMSymbolExpr SDBMSymbolExpr::get(SDBMDialect *dialect, unsigned position) { StorageUniquer &uniquer = dialect->getUniquer(); return uniquer.get( - assignDialect, static_cast(SDBMExprKind::SymbolId), position); + TypeID::get(), assignDialect, + static_cast(SDBMExprKind::SymbolId), position); } //===----------------------------------------------------------------------===// @@ -640,7 +645,8 @@ SDBMConstantExpr SDBMConstantExpr::get(SDBMDialect *dialect, int64_t value) { StorageUniquer &uniquer = dialect->getUniquer(); return uniquer.get( - assignCtx, static_cast(SDBMExprKind::Constant), value); + TypeID::get(), assignCtx, + static_cast(SDBMExprKind::Constant), value); } int64_t SDBMConstantExpr::getValue() const { @@ -656,6 +662,7 @@ SDBMNegExpr SDBMNegExpr::get(SDBMDirectExpr var) { StorageUniquer &uniquer = var.getDialect()->getUniquer(); return uniquer.get( + TypeID::get(), /*initFn=*/{}, static_cast(SDBMExprKind::Neg), var); } diff --git a/mlir/lib/IR/AffineExpr.cpp b/mlir/lib/IR/AffineExpr.cpp index c78e7e1eac57b1..83d080f17d7df0 100644 --- a/mlir/lib/IR/AffineExpr.cpp +++ b/mlir/lib/IR/AffineExpr.cpp @@ -12,6 +12,7 @@ #include "mlir/IR/AffineMap.h" #include "mlir/IR/IntegerSet.h" #include "mlir/Support/MathExtras.h" +#include "mlir/Support/TypeID.h" #include "llvm/ADT/STLExtras.h" using namespace mlir; @@ -448,7 +449,8 @@ static AffineExpr getAffineDimOrSymbol(AffineExprKind kind, unsigned position, StorageUniquer &uniquer = context->getAffineUniquer(); return uniquer.get( - assignCtx, static_cast(kind), position); + TypeID::get(), assignCtx, + static_cast(kind), position); } AffineExpr mlir::getAffineDimExpr(unsigned position, MLIRContext *context) { @@ -483,7 +485,8 @@ AffineExpr mlir::getAffineConstantExpr(int64_t constant, MLIRContext *context) { StorageUniquer &uniquer = context->getAffineUniquer(); return uniquer.get( - assignCtx, static_cast(AffineExprKind::Constant), constant); + TypeID::get(), assignCtx, + static_cast(AffineExprKind::Constant), constant); } /// Simplify add expression. Return nullptr if it can't be simplified. @@ -591,6 +594,7 @@ AffineExpr AffineExpr::operator+(AffineExpr other) const { StorageUniquer &uniquer = getContext()->getAffineUniquer(); return uniquer.get( + TypeID::get(), /*initFn=*/{}, static_cast(AffineExprKind::Add), *this, other); } @@ -651,6 +655,7 @@ AffineExpr AffineExpr::operator*(AffineExpr other) const { StorageUniquer &uniquer = getContext()->getAffineUniquer(); return uniquer.get( + TypeID::get(), /*initFn=*/{}, static_cast(AffineExprKind::Mul), *this, other); } @@ -717,6 +722,7 @@ AffineExpr AffineExpr::floorDiv(AffineExpr other) const { StorageUniquer &uniquer = getContext()->getAffineUniquer(); return uniquer.get( + TypeID::get(), /*initFn=*/{}, static_cast(AffineExprKind::FloorDiv), *this, other); } @@ -760,6 +766,7 @@ AffineExpr AffineExpr::ceilDiv(AffineExpr other) const { StorageUniquer &uniquer = getContext()->getAffineUniquer(); return uniquer.get( + TypeID::get(), /*initFn=*/{}, static_cast(AffineExprKind::CeilDiv), *this, other); } @@ -807,6 +814,7 @@ AffineExpr AffineExpr::operator%(AffineExpr other) const { StorageUniquer &uniquer = getContext()->getAffineUniquer(); return uniquer.get( + TypeID::get(), /*initFn=*/{}, static_cast(AffineExprKind::Mod), *this, other); } diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp index 32ee60f5512a67..df58b957bc3217 100644 --- a/mlir/lib/IR/MLIRContext.cpp +++ b/mlir/lib/IR/MLIRContext.cpp @@ -402,6 +402,13 @@ MLIRContext::MLIRContext() : impl(new MLIRContextImpl()) { /// The empty dictionary attribute. impl->emptyDictionaryAttr = AttributeUniquer::get( this, StandardAttributes::Dictionary, ArrayRef()); + + // Register the affine storage objects with the uniquer. + impl->affineUniquer.registerStorageType( + TypeID::get()); + impl->affineUniquer.registerStorageType( + TypeID::get()); + impl->affineUniquer.registerStorageType(TypeID::get()); } MLIRContext::~MLIRContext() {} @@ -571,6 +578,7 @@ void Dialect::addType(TypeID typeID, AbstractType &&typeInfo) { AbstractType(std::move(typeInfo)); if (!impl.registeredTypes.insert({typeID, newInfo}).second) llvm::report_fatal_error("Dialect Type already registered."); + impl.typeUniquer.registerStorageType(typeID); } void Dialect::addAttribute(TypeID typeID, AbstractAttribute &&attrInfo) { @@ -580,6 +588,7 @@ void Dialect::addAttribute(TypeID typeID, AbstractAttribute &&attrInfo) { AbstractAttribute(std::move(attrInfo)); if (!impl.registeredAttributes.insert({typeID, newInfo}).second) llvm::report_fatal_error("Dialect Attribute already registered."); + impl.attributeUniquer.registerStorageType(typeID); } /// Get the dialect that registered the attribute with the provided typeid. diff --git a/mlir/lib/Support/StorageUniquer.cpp b/mlir/lib/Support/StorageUniquer.cpp index f7c953e98140f7..49e7272091fbfb 100644 --- a/mlir/lib/Support/StorageUniquer.cpp +++ b/mlir/lib/Support/StorageUniquer.cpp @@ -9,15 +9,18 @@ #include "mlir/Support/StorageUniquer.h" #include "mlir/Support/LLVM.h" +#include "mlir/Support/TypeID.h" #include "llvm/Support/RWMutex.h" using namespace mlir; using namespace mlir::detail; -namespace mlir { -namespace detail { -/// This is the implementation of the StorageUniquer class. -struct StorageUniquerImpl { +namespace { +/// This class represents a uniquer for storage instances of a specific type. It +/// contains all of the necessary data to unique storage instances in a thread +/// safe way. This allows for the main uniquer to bucket each of the individual +/// sub-types removing the need to lock the main uniquer itself. +struct InstSpecificUniquer { using BaseStorage = StorageUniquer::BaseStorage; using StorageAllocator = StorageUniquer::StorageAllocator; @@ -40,98 +43,160 @@ struct StorageUniquerImpl { BaseStorage *storage; }; + /// Storage info for derived TypeStorage objects. + struct StorageKeyInfo : DenseMapInfo { + static HashedStorage getEmptyKey() { + return HashedStorage{0, DenseMapInfo::getEmptyKey()}; + } + static HashedStorage getTombstoneKey() { + return HashedStorage{0, DenseMapInfo::getTombstoneKey()}; + } + + static unsigned getHashValue(const HashedStorage &key) { + return key.hashValue; + } + static unsigned getHashValue(LookupKey key) { return key.hashValue; } + + static bool isEqual(const HashedStorage &lhs, const HashedStorage &rhs) { + return lhs.storage == rhs.storage; + } + static bool isEqual(const LookupKey &lhs, const HashedStorage &rhs) { + if (isEqual(rhs, getEmptyKey()) || isEqual(rhs, getTombstoneKey())) + return false; + // If the lookup kind matches the kind of the storage, then invoke the + // equality function on the lookup key. + return lhs.kind == rhs.storage->getKind() && lhs.isEqual(rhs.storage); + } + }; + + /// Unique types with specific hashing or storage constraints. + using StorageTypeSet = DenseSet; + StorageTypeSet complexInstances; + + /// Instances of this storage object. + llvm::SmallDenseMap simpleInstances; + + /// Allocator to use when constructing derived instances. + StorageAllocator allocator; + + /// A mutex to keep type uniquing thread-safe. + llvm::sys::SmartRWMutex mutex; +}; +} // end anonymous namespace + +namespace mlir { +namespace detail { +/// This is the implementation of the StorageUniquer class. +struct StorageUniquerImpl { + using BaseStorage = StorageUniquer::BaseStorage; + using StorageAllocator = StorageUniquer::StorageAllocator; + /// Get or create an instance of a complex derived type. BaseStorage * - getOrCreate(unsigned kind, unsigned hashValue, + getOrCreate(TypeID id, unsigned kind, unsigned hashValue, function_ref isEqual, function_ref ctorFn) { - LookupKey lookupKey{kind, hashValue, isEqual}; + assert(instUniquers.count(id) && "creating unregistered storage instance"); + InstSpecificUniquer::LookupKey lookupKey{kind, hashValue, isEqual}; + InstSpecificUniquer &storageUniquer = *instUniquers[id]; if (!threadingIsEnabled) - return getOrCreateUnsafe(kind, hashValue, lookupKey, ctorFn); + return getOrCreateUnsafe(storageUniquer, kind, lookupKey, ctorFn); // Check for an existing instance in read-only mode. { - llvm::sys::SmartScopedReader typeLock(mutex); - auto it = storageTypes.find_as(lookupKey); - if (it != storageTypes.end()) + llvm::sys::SmartScopedReader typeLock(storageUniquer.mutex); + auto it = storageUniquer.complexInstances.find_as(lookupKey); + if (it != storageUniquer.complexInstances.end()) return it->storage; } // Acquire a writer-lock so that we can safely create the new type instance. - llvm::sys::SmartScopedWriter typeLock(mutex); - return getOrCreateUnsafe(kind, hashValue, lookupKey, ctorFn); + llvm::sys::SmartScopedWriter typeLock(storageUniquer.mutex); + return getOrCreateUnsafe(storageUniquer, kind, lookupKey, ctorFn); } - /// Get or create an instance of a complex derived type in an unsafe fashion. + /// Get or create an instance of a complex derived type in an thread-unsafe + /// fashion. BaseStorage * - getOrCreateUnsafe(unsigned kind, unsigned hashValue, LookupKey &lookupKey, + getOrCreateUnsafe(InstSpecificUniquer &storageUniquer, unsigned kind, + InstSpecificUniquer::LookupKey &lookupKey, function_ref ctorFn) { - auto existing = storageTypes.insert_as({}, lookupKey); + auto existing = storageUniquer.complexInstances.insert_as({}, lookupKey); if (!existing.second) return existing.first->storage; // Otherwise, construct and initialize the derived storage for this type // instance. - BaseStorage *storage = initializeStorage(kind, ctorFn); - *existing.first = HashedStorage{hashValue, storage}; + BaseStorage *storage = + initializeStorage(kind, storageUniquer.allocator, ctorFn); + *existing.first = + InstSpecificUniquer::HashedStorage{lookupKey.hashValue, storage}; return storage; } /// Get or create an instance of a simple derived type. BaseStorage * - getOrCreate(unsigned kind, + getOrCreate(TypeID id, unsigned kind, function_ref ctorFn) { + assert(instUniquers.count(id) && "creating unregistered storage instance"); + InstSpecificUniquer &storageUniquer = *instUniquers[id]; if (!threadingIsEnabled) - return getOrCreateUnsafe(kind, ctorFn); + return getOrCreateUnsafe(storageUniquer, kind, ctorFn); // Check for an existing instance in read-only mode. { - llvm::sys::SmartScopedReader typeLock(mutex); - auto it = simpleTypes.find(kind); - if (it != simpleTypes.end()) + llvm::sys::SmartScopedReader typeLock(storageUniquer.mutex); + auto it = storageUniquer.simpleInstances.find(kind); + if (it != storageUniquer.simpleInstances.end()) return it->second; } // Acquire a writer-lock so that we can safely create the new type instance. - llvm::sys::SmartScopedWriter typeLock(mutex); - return getOrCreateUnsafe(kind, ctorFn); + llvm::sys::SmartScopedWriter typeLock(storageUniquer.mutex); + return getOrCreateUnsafe(storageUniquer, kind, ctorFn); } - /// Get or create an instance of a simple derived type in an unsafe fashion. + /// Get or create an instance of a simple derived type in an thread-unsafe + /// fashion. BaseStorage * - getOrCreateUnsafe(unsigned kind, + getOrCreateUnsafe(InstSpecificUniquer &storageUniquer, unsigned kind, function_ref ctorFn) { - auto &result = simpleTypes[kind]; + auto &result = storageUniquer.simpleInstances[kind]; if (result) return result; // Otherwise, create and return a new storage instance. - return result = initializeStorage(kind, ctorFn); + return result = initializeStorage(kind, storageUniquer.allocator, ctorFn); } /// Erase an instance of a complex derived type. - void erase(unsigned kind, unsigned hashValue, + void erase(TypeID id, unsigned kind, unsigned hashValue, function_ref isEqual, function_ref cleanupFn) { - LookupKey lookupKey{kind, hashValue, isEqual}; + assert(instUniquers.count(id) && "erasing unregistered storage instance"); + InstSpecificUniquer &storageUniquer = *instUniquers[id]; + InstSpecificUniquer::LookupKey lookupKey{kind, hashValue, isEqual}; // Acquire a writer-lock so that we can safely erase the type instance. - llvm::sys::SmartScopedWriter typeLock(mutex); - auto existing = storageTypes.find_as(lookupKey); - if (existing == storageTypes.end()) + llvm::sys::SmartScopedWriter lock(storageUniquer.mutex); + auto existing = storageUniquer.complexInstances.find_as(lookupKey); + if (existing == storageUniquer.complexInstances.end()) return; // Cleanup the storage and remove it from the map. cleanupFn(existing->storage); - storageTypes.erase(existing); + storageUniquer.complexInstances.erase(existing); } /// Mutates an instance of a derived storage in a thread-safe way. LogicalResult - mutate(function_ref mutationFn) { + mutate(TypeID id, + function_ref mutationFn) { + assert(instUniquers.count(id) && "mutating unregistered storage instance"); + InstSpecificUniquer &storageUniquer = *instUniquers[id]; if (!threadingIsEnabled) - return mutationFn(allocator); + return mutationFn(storageUniquer.allocator); - llvm::sys::SmartScopedWriter lock(mutex); - return mutationFn(allocator); + llvm::sys::SmartScopedWriter lock(storageUniquer.mutex); + return mutationFn(storageUniquer.allocator); } //===--------------------------------------------------------------------===// @@ -140,51 +205,15 @@ struct StorageUniquerImpl { /// Utility to create and initialize a storage instance. BaseStorage * - initializeStorage(unsigned kind, + initializeStorage(unsigned kind, StorageAllocator &allocator, function_ref ctorFn) { BaseStorage *storage = ctorFn(allocator); storage->kind = kind; return storage; } - /// Storage info for derived TypeStorage objects. - struct StorageKeyInfo : DenseMapInfo { - static HashedStorage getEmptyKey() { - return HashedStorage{0, DenseMapInfo::getEmptyKey()}; - } - static HashedStorage getTombstoneKey() { - return HashedStorage{0, DenseMapInfo::getTombstoneKey()}; - } - - static unsigned getHashValue(const HashedStorage &key) { - return key.hashValue; - } - static unsigned getHashValue(LookupKey key) { return key.hashValue; } - - static bool isEqual(const HashedStorage &lhs, const HashedStorage &rhs) { - return lhs.storage == rhs.storage; - } - static bool isEqual(const LookupKey &lhs, const HashedStorage &rhs) { - if (isEqual(rhs, getEmptyKey()) || isEqual(rhs, getTombstoneKey())) - return false; - // If the lookup kind matches the kind of the storage, then invoke the - // equality function on the lookup key. - return lhs.kind == rhs.storage->getKind() && lhs.isEqual(rhs.storage); - } - }; - - /// Unique types with specific hashing or storage constraints. - using StorageTypeSet = DenseSet; - StorageTypeSet storageTypes; - - /// Unique types with just the kind. - DenseMap simpleTypes; - - /// Allocator to use when constructing derived type instances. - StorageUniquer::StorageAllocator allocator; - - /// A mutex to keep type uniquing thread-safe. - llvm::sys::SmartRWMutex mutex; + /// Map of type ids to the storage uniquer to use for registered objects. + DenseMap> instUniquers; /// Flag specifying if multi-threading is enabled within the uniquer. bool threadingIsEnabled = true; @@ -200,33 +229,41 @@ void StorageUniquer::disableMultithreading(bool disable) { impl->threadingIsEnabled = !disable; } +/// Register a new storage object with this uniquer using the given unique type +/// id. +void StorageUniquer::registerStorageType(TypeID id) { + impl->instUniquers.try_emplace(id, std::make_unique()); +} + /// Implementation for getting/creating an instance of a derived type with /// complex storage. auto StorageUniquer::getImpl( - unsigned kind, unsigned hashValue, + const TypeID &id, unsigned kind, unsigned hashValue, function_ref isEqual, function_ref ctorFn) -> BaseStorage * { - return impl->getOrCreate(kind, hashValue, isEqual, ctorFn); + return impl->getOrCreate(id, kind, hashValue, isEqual, ctorFn); } /// Implementation for getting/creating an instance of a derived type with /// default storage. auto StorageUniquer::getImpl( - unsigned kind, function_ref ctorFn) - -> BaseStorage * { - return impl->getOrCreate(kind, ctorFn); + const TypeID &id, unsigned kind, + function_ref ctorFn) -> BaseStorage * { + return impl->getOrCreate(id, kind, ctorFn); } /// Implementation for erasing an instance of a derived type with complex /// storage. -void StorageUniquer::eraseImpl(unsigned kind, unsigned hashValue, +void StorageUniquer::eraseImpl(const TypeID &id, unsigned kind, + unsigned hashValue, function_ref isEqual, function_ref cleanupFn) { - impl->erase(kind, hashValue, isEqual, cleanupFn); + impl->erase(id, kind, hashValue, isEqual, cleanupFn); } /// Implementation for mutating an instance of a derived storage. LogicalResult StorageUniquer::mutateImpl( + const TypeID &id, function_ref mutationFn) { - return impl->mutate(mutationFn); + return impl->mutate(id, mutationFn); } From 9f24640b7e6e61b0f293c724155a90a5e446dd7a Mon Sep 17 00:00:00 2001 From: River Riddle Date: Fri, 7 Aug 2020 13:29:36 -0700 Subject: [PATCH 10/26] [mlir] Add a utility class, ThreadLocalCache, for storing non static thread local objects. This class allows for defining thread local objects that have a set non-static lifetime. This internals of the cache use a static thread_local map between the various different non-static objects and the desired value type. When a non-static object destructs, it simply nulls out the entry in the static map. This will leave an entry in the map, but erase any of the data for the associated value. The current use cases for this are in the MLIRContext, meaning that the number of items in the static map is ~1-2 which aren't particularly costly enough to warrant the complexity of pruning. If a use case arises that requires pruning of the map, the functionality can be added. This is especially useful in the context of MLIR for implementing thread-local caching of context level objects that would otherwise have very high lock contention. This revision adds a thread local cache in the MLIRContext for attributes, identifiers, and types to reduce some of the locking burden. This led to a speedup of several hundred miliseconds when compiling a conversion pass on a very large mlir module(>300K operations). Differential Revision: https://reviews.llvm.org/D82597 --- mlir/include/mlir/Support/ThreadLocalCache.h | 117 +++++++++++++++++++ mlir/lib/IR/MLIRContext.cpp | 39 +++++-- mlir/lib/Support/StorageUniquer.cpp | 41 +++++-- mlir/test/EDSC/builder-api-test.cpp | 2 +- 4 files changed, 176 insertions(+), 23 deletions(-) create mode 100644 mlir/include/mlir/Support/ThreadLocalCache.h diff --git a/mlir/include/mlir/Support/ThreadLocalCache.h b/mlir/include/mlir/Support/ThreadLocalCache.h new file mode 100644 index 00000000000000..3b5d6f0f424f9b --- /dev/null +++ b/mlir/include/mlir/Support/ThreadLocalCache.h @@ -0,0 +1,117 @@ +//===- ThreadLocalCache.h - ThreadLocalCache class --------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file contains a definition of the ThreadLocalCache class. This class +// provides support for defining thread local objects with non-static duration. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_SUPPORT_THREADLOCALCACHE_H +#define MLIR_SUPPORT_THREADLOCALCACHE_H + +#include "mlir/Support/LLVM.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/Support/ManagedStatic.h" +#include "llvm/Support/Mutex.h" +#include "llvm/Support/ThreadLocal.h" + +namespace mlir { +/// This class provides support for defining a thread local object with non +/// static storage duration. This is very useful for situations in which a data +/// cache has very large lock contention. +template +class ThreadLocalCache { + /// The type used for the static thread_local cache. This is a map between an + /// instance of the non-static cache and a weak reference to an instance of + /// ValueT. We use a weak reference here so that the object can be destroyed + /// without needing to lock access to the cache itself. + struct CacheType : public llvm::SmallDenseMap *, + std::weak_ptr> { + ~CacheType() { + // Remove the values of this cache that haven't already expired. + for (auto &it : *this) + if (std::shared_ptr value = it.second.lock()) + it.first->remove(value.get()); + } + + /// Clear out any unused entries within the map. This method is not + /// thread-safe, and should only be called by the same thread as the cache. + void clearExpiredEntries() { + for (auto it = this->begin(), e = this->end(); it != e;) { + auto curIt = it++; + if (curIt->second.expired()) + this->erase(curIt); + } + } + }; + +public: + ThreadLocalCache() = default; + ~ThreadLocalCache() { + // No cleanup is necessary here as the shared_pointer memory will go out of + // scope and invalidate the weak pointers held by the thread_local caches. + } + + /// Return an instance of the value type for the current thread. + ValueT &get() { + // Check for an already existing instance for this thread. + CacheType &staticCache = getStaticCache(); + std::weak_ptr &threadInstance = staticCache[this]; + if (std::shared_ptr value = threadInstance.lock()) + return *value; + + // Otherwise, create a new instance for this thread. + llvm::sys::SmartScopedLock threadInstanceLock(instanceMutex); + instances.push_back(std::make_shared()); + std::shared_ptr &instance = instances.back(); + threadInstance = instance; + + // Before returning the new instance, take the chance to clear out any used + // entries in the static map. The cache is only cleared within the same + // thread to remove the need to lock the cache itself. + staticCache.clearExpiredEntries(); + return *instance; + } + ValueT &operator*() { return get(); } + ValueT *operator->() { return &get(); } + +private: + ThreadLocalCache(ThreadLocalCache &&) = delete; + ThreadLocalCache(const ThreadLocalCache &) = delete; + ThreadLocalCache &operator=(const ThreadLocalCache &) = delete; + + /// Return the static thread local instance of the cache type. + static CacheType &getStaticCache() { + static LLVM_THREAD_LOCAL CacheType cache; + return cache; + } + + /// Remove the given value entry. This is generally called when a thread local + /// cache is destructing. + void remove(ValueT *value) { + // Erase the found value directly, because it is guaranteed to be in the + // list. + llvm::sys::SmartScopedLock threadInstanceLock(instanceMutex); + auto it = llvm::find_if(instances, [&](std::shared_ptr &instance) { + return instance.get() == value; + }); + assert(it != instances.end() && "expected value to exist in cache"); + instances.erase(it); + } + + /// Owning pointers to all of the values that have been constructed for this + /// object in the static cache. + SmallVector, 1> instances; + + /// A mutex used when a new thread instance has been added to the cache for + /// this object. + llvm::sys::SmartMutex instanceMutex; +}; +} // end namespace mlir + +#endif // MLIR_SUPPORT_THREADLOCALCACHE_H diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp index df58b957bc3217..42c4d4855e503b 100644 --- a/mlir/lib/IR/MLIRContext.cpp +++ b/mlir/lib/IR/MLIRContext.cpp @@ -24,6 +24,7 @@ #include "mlir/IR/Location.h" #include "mlir/IR/Module.h" #include "mlir/IR/Types.h" +#include "mlir/Support/ThreadLocalCache.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SetVector.h" @@ -280,8 +281,12 @@ class MLIRContextImpl { /// operations. llvm::StringMap registeredOperations; - /// These are identifiers uniqued into this MLIRContext. + /// Identifers are uniqued by string value and use the internal string set for + /// storage. llvm::StringSet identifiers; + /// A thread local cache of identifiers to reduce lock contention. + ThreadLocalCache *>> + localIdentifierCache; /// An allocator used for AbstractAttribute and AbstractType objects. llvm::BumpPtrAllocator abstractDialectSymbolAllocator; @@ -629,27 +634,37 @@ const AbstractType &AbstractType::lookup(TypeID typeID, MLIRContext *context) { /// Return an identifier for the specified string. Identifier Identifier::get(StringRef str, MLIRContext *context) { + // Check invariants after seeing if we already have something in the + // identifier table - if we already had it in the table, then it already + // passed invariant checks. + assert(!str.empty() && "Cannot create an empty identifier"); + assert(str.find('\0') == StringRef::npos && + "Cannot create an identifier with a nul character"); + auto &impl = context->getImpl(); + if (!context->isMultithreadingEnabled()) + return Identifier(&*impl.identifiers.insert(str).first); + + // Check for an existing instance in the local cache. + auto *&localEntry = (*impl.localIdentifierCache)[str]; + if (localEntry) + return Identifier(localEntry); // Check for an existing identifier in read-only mode. if (context->isMultithreadingEnabled()) { llvm::sys::SmartScopedReader contextLock(impl.identifierMutex); auto it = impl.identifiers.find(str); - if (it != impl.identifiers.end()) - return Identifier(&*it); + if (it != impl.identifiers.end()) { + localEntry = &*it; + return Identifier(localEntry); + } } - // Check invariants after seeing if we already have something in the - // identifier table - if we already had it in the table, then it already - // passed invariant checks. - assert(!str.empty() && "Cannot create an empty identifier"); - assert(str.find('\0') == StringRef::npos && - "Cannot create an identifier with a nul character"); - // Acquire a writer-lock so that we can safely create the new instance. - ScopedWriterLock contextLock(impl.identifierMutex, impl.threadingIsEnabled); + llvm::sys::SmartScopedWriter contextLock(impl.identifierMutex); auto it = impl.identifiers.insert(str).first; - return Identifier(&*it); + localEntry = &*it; + return Identifier(localEntry); } //===----------------------------------------------------------------------===// diff --git a/mlir/lib/Support/StorageUniquer.cpp b/mlir/lib/Support/StorageUniquer.cpp index 49e7272091fbfb..3fb6d3733b2333 100644 --- a/mlir/lib/Support/StorageUniquer.cpp +++ b/mlir/lib/Support/StorageUniquer.cpp @@ -9,6 +9,7 @@ #include "mlir/Support/StorageUniquer.h" #include "mlir/Support/LLVM.h" +#include "mlir/Support/ThreadLocalCache.h" #include "mlir/Support/TypeID.h" #include "llvm/Support/RWMutex.h" @@ -39,6 +40,8 @@ struct InstSpecificUniquer { /// A utility wrapper object representing a hashed storage object. This class /// contains a storage object and an existing computed hash value. struct HashedStorage { + HashedStorage(unsigned hashValue = 0, BaseStorage *storage = nullptr) + : hashValue(hashValue), storage(storage) {} unsigned hashValue; BaseStorage *storage; }; @@ -46,10 +49,10 @@ struct InstSpecificUniquer { /// Storage info for derived TypeStorage objects. struct StorageKeyInfo : DenseMapInfo { static HashedStorage getEmptyKey() { - return HashedStorage{0, DenseMapInfo::getEmptyKey()}; + return HashedStorage(0, DenseMapInfo::getEmptyKey()); } static HashedStorage getTombstoneKey() { - return HashedStorage{0, DenseMapInfo::getTombstoneKey()}; + return HashedStorage(0, DenseMapInfo::getTombstoneKey()); } static unsigned getHashValue(const HashedStorage &key) { @@ -102,25 +105,34 @@ struct StorageUniquerImpl { if (!threadingIsEnabled) return getOrCreateUnsafe(storageUniquer, kind, lookupKey, ctorFn); + // Check for a instance of this object in the local cache. + auto localIt = complexStorageLocalCache->insert_as( + InstSpecificUniquer::HashedStorage(lookupKey.hashValue), lookupKey); + BaseStorage *&localInst = localIt.first->storage; + if (localInst) + return localInst; + // Check for an existing instance in read-only mode. { llvm::sys::SmartScopedReader typeLock(storageUniquer.mutex); auto it = storageUniquer.complexInstances.find_as(lookupKey); if (it != storageUniquer.complexInstances.end()) - return it->storage; + return localInst = it->storage; } // Acquire a writer-lock so that we can safely create the new type instance. llvm::sys::SmartScopedWriter typeLock(storageUniquer.mutex); - return getOrCreateUnsafe(storageUniquer, kind, lookupKey, ctorFn); + return localInst = + getOrCreateUnsafe(storageUniquer, kind, lookupKey, ctorFn); } /// Get or create an instance of a complex derived type in an thread-unsafe /// fashion. BaseStorage * getOrCreateUnsafe(InstSpecificUniquer &storageUniquer, unsigned kind, - InstSpecificUniquer::LookupKey &lookupKey, + InstSpecificUniquer::LookupKey &key, function_ref ctorFn) { - auto existing = storageUniquer.complexInstances.insert_as({}, lookupKey); + auto existing = + storageUniquer.complexInstances.insert_as({key.hashValue}, key); if (!existing.second) return existing.first->storage; @@ -128,9 +140,7 @@ struct StorageUniquerImpl { // instance. BaseStorage *storage = initializeStorage(kind, storageUniquer.allocator, ctorFn); - *existing.first = - InstSpecificUniquer::HashedStorage{lookupKey.hashValue, storage}; - return storage; + return existing.first->storage = storage; } /// Get or create an instance of a simple derived type. @@ -142,6 +152,11 @@ struct StorageUniquerImpl { if (!threadingIsEnabled) return getOrCreateUnsafe(storageUniquer, kind, ctorFn); + // Check for a instance of this object in the local cache. + BaseStorage *&localInst = (*simpleStorageLocalCache)[kind]; + if (localInst) + return localInst; + // Check for an existing instance in read-only mode. { llvm::sys::SmartScopedReader typeLock(storageUniquer.mutex); @@ -152,7 +167,7 @@ struct StorageUniquerImpl { // Acquire a writer-lock so that we can safely create the new type instance. llvm::sys::SmartScopedWriter typeLock(storageUniquer.mutex); - return getOrCreateUnsafe(storageUniquer, kind, ctorFn); + return localInst = getOrCreateUnsafe(storageUniquer, kind, ctorFn); } /// Get or create an instance of a simple derived type in an thread-unsafe /// fashion. @@ -215,6 +230,12 @@ struct StorageUniquerImpl { /// Map of type ids to the storage uniquer to use for registered objects. DenseMap> instUniquers; + /// A thread local cache for simple and complex storage objects. This helps to + /// reduce the lock contention when an object already existing in the cache. + ThreadLocalCache> simpleStorageLocalCache; + ThreadLocalCache + complexStorageLocalCache; + /// Flag specifying if multi-threading is enabled within the uniquer. bool threadingIsEnabled = true; }; diff --git a/mlir/test/EDSC/builder-api-test.cpp b/mlir/test/EDSC/builder-api-test.cpp index 3fcfcf24ef8fe4..b620062e2238f8 100644 --- a/mlir/test/EDSC/builder-api-test.cpp +++ b/mlir/test/EDSC/builder-api-test.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// RUN: mlir-edsc-builder-api-test | FileCheck %s +// RUN: mlir-edsc-builder-api-test #include "mlir/Dialect/Affine/EDSC/Intrinsics.h" #include "mlir/Dialect/Linalg/EDSC/Builders.h" From dd48773396f77fd7b19adc43b23d41aef356809a Mon Sep 17 00:00:00 2001 From: River Riddle Date: Fri, 7 Aug 2020 13:29:55 -0700 Subject: [PATCH 11/26] [mlir][Types] Remove the subclass data from Type Subclass data is useful when a certain amount of memory is allocated, but not all of it is used. In the case of Type, that hasn't been the case for a while and the subclass is just taking up a full `unsigned`. Removing this frees up ~8 bytes for almost every type instance. Differential Revision: https://reviews.llvm.org/D85348 --- mlir/include/mlir/IR/StandardTypes.h | 2 +- mlir/include/mlir/IR/TypeSupport.h | 12 +- mlir/include/mlir/IR/Types.h | 6 +- mlir/lib/Dialect/SPIRV/SPIRVTypes.cpp | 185 ++++++-------------------- mlir/lib/IR/StandardTypes.cpp | 4 +- mlir/lib/IR/TypeDetail.h | 69 ++++------ mlir/lib/IR/Types.cpp | 5 +- 7 files changed, 79 insertions(+), 204 deletions(-) diff --git a/mlir/include/mlir/IR/StandardTypes.h b/mlir/include/mlir/IR/StandardTypes.h index 3daf226603a83e..406598c9d061b3 100644 --- a/mlir/include/mlir/IR/StandardTypes.h +++ b/mlir/include/mlir/IR/StandardTypes.h @@ -127,7 +127,7 @@ class IntegerType using Base::Base; /// Signedness semantics. - enum SignednessSemantics { + enum SignednessSemantics : uint32_t { Signless, /// No signedness semantics Signed, /// Signed integer Unsigned, /// Unsigned integer diff --git a/mlir/include/mlir/IR/TypeSupport.h b/mlir/include/mlir/IR/TypeSupport.h index 0e1a6c72c11d96..c26aec6411c00c 100644 --- a/mlir/include/mlir/IR/TypeSupport.h +++ b/mlir/include/mlir/IR/TypeSupport.h @@ -79,16 +79,9 @@ class TypeStorage : public StorageUniquer::BaseStorage { return *abstractType; } - /// Get the subclass data. - unsigned getSubclassData() const { return subclassData; } - - /// Set the subclass data. - void setSubclassData(unsigned val) { subclassData = val; } - protected: /// This constructor is used by derived classes as part of the TypeUniquer. - TypeStorage(unsigned subclassData = 0) - : abstractType(nullptr), subclassData(subclassData) {} + TypeStorage() : abstractType(nullptr) {} private: /// Set the abstract type for this storage instance. This is used by the @@ -99,9 +92,6 @@ class TypeStorage : public StorageUniquer::BaseStorage { /// The abstract description for this type. const AbstractType *abstractType; - - /// Space for subclasses to store data. - unsigned subclassData; }; /// Default storage type for types that require no additional initialization or diff --git a/mlir/include/mlir/IR/Types.h b/mlir/include/mlir/IR/Types.h index ed63f696a84cad..bd0ea4bbd5dc0b 100644 --- a/mlir/include/mlir/IR/Types.h +++ b/mlir/include/mlir/IR/Types.h @@ -192,9 +192,6 @@ class Type { friend ::llvm::hash_code hash_value(Type arg); - unsigned getSubclassData() const; - void setSubclassData(unsigned val); - /// Methods for supporting PointerLikeTypeTraits. const void *getAsOpaquePointer() const { return static_cast(impl); @@ -264,7 +261,8 @@ class FunctionType MLIRContext *context); // Input types. - unsigned getNumInputs() const { return getSubclassData(); } + unsigned getNumInputs() const; + Type getInput(unsigned i) const { return getInputs()[i]; } ArrayRef getInputs() const; diff --git a/mlir/lib/Dialect/SPIRV/SPIRVTypes.cpp b/mlir/lib/Dialect/SPIRV/SPIRVTypes.cpp index 583a779408b471..be42ca833f2150 100644 --- a/mlir/lib/Dialect/SPIRV/SPIRVTypes.cpp +++ b/mlir/lib/Dialect/SPIRV/SPIRVTypes.cpp @@ -108,14 +108,15 @@ struct spirv::detail::ArrayTypeStorage : public TypeStorage { } bool operator==(const KeyTy &key) const { - return key == KeyTy(elementType, getSubclassData(), stride); + return key == KeyTy(elementType, elementCount, stride); } ArrayTypeStorage(const KeyTy &key) - : TypeStorage(std::get<1>(key)), elementType(std::get<0>(key)), + : elementType(std::get<0>(key)), elementCount(std::get<1>(key)), stride(std::get<2>(key)) {} Type elementType; + unsigned elementCount; unsigned stride; }; @@ -132,9 +133,7 @@ ArrayType ArrayType::get(Type elementType, unsigned elementCount, elementCount, stride); } -unsigned ArrayType::getNumElements() const { - return getImpl()->getSubclassData(); -} +unsigned ArrayType::getNumElements() const { return getImpl()->elementCount; } Type ArrayType::getElementType() const { return getImpl()->elementType; } @@ -321,19 +320,17 @@ struct spirv::detail::CooperativeMatrixTypeStorage : public TypeStorage { } bool operator==(const KeyTy &key) const { - return key == KeyTy(elementType, getScope(), rows, columns); + return key == KeyTy(elementType, scope, rows, columns); } CooperativeMatrixTypeStorage(const KeyTy &key) - : TypeStorage(static_cast(std::get<1>(key))), - elementType(std::get<0>(key)), rows(std::get<2>(key)), - columns(std::get<3>(key)) {} - - Scope getScope() const { return static_cast(getSubclassData()); } + : elementType(std::get<0>(key)), rows(std::get<2>(key)), + columns(std::get<3>(key)), scope(std::get<1>(key)) {} Type elementType; unsigned rows; unsigned columns; + Scope scope; }; CooperativeMatrixNVType CooperativeMatrixNVType::get(Type elementType, @@ -347,9 +344,7 @@ Type CooperativeMatrixNVType::getElementType() const { return getImpl()->elementType; } -Scope CooperativeMatrixNVType::getScope() const { - return getImpl()->getScope(); -} +Scope CooperativeMatrixNVType::getScope() const { return getImpl()->scope; } unsigned CooperativeMatrixNVType::getRows() const { return getImpl()->rows; } @@ -412,20 +407,6 @@ template <> constexpr unsigned getNumBits() { } struct spirv::detail::ImageTypeStorage : public TypeStorage { -private: - /// Define a bit-field struct to pack the enum values - union EnumPack { - struct { - unsigned dimEncoding : getNumBits(); - unsigned depthInfoEncoding : getNumBits(); - unsigned arrayedInfoEncoding : getNumBits(); - unsigned samplingInfoEncoding : getNumBits(); - unsigned samplerUseInfoEncoding : getNumBits(); - unsigned formatEncoding : getNumBits(); - } data; - unsigned storage; - }; - public: using KeyTy = std::tuple; @@ -436,95 +417,23 @@ struct spirv::detail::ImageTypeStorage : public TypeStorage { } bool operator==(const KeyTy &key) const { - return key == KeyTy(elementType, getDim(), getDepthInfo(), getArrayedInfo(), - getSamplingInfo(), getSamplerUseInfo(), - getImageFormat()); - } - - Dim getDim() const { - EnumPack v; - v.storage = getSubclassData(); - return static_cast(v.data.dimEncoding); - } - void setDim(Dim dim) { - EnumPack v; - v.storage = getSubclassData(); - v.data.dimEncoding = static_cast(dim); - setSubclassData(v.storage); - } - - ImageDepthInfo getDepthInfo() const { - EnumPack v; - v.storage = getSubclassData(); - return static_cast(v.data.depthInfoEncoding); - } - void setDepthInfo(ImageDepthInfo depthInfo) { - EnumPack v; - v.storage = getSubclassData(); - v.data.depthInfoEncoding = static_cast(depthInfo); - setSubclassData(v.storage); - } - - ImageArrayedInfo getArrayedInfo() const { - EnumPack v; - v.storage = getSubclassData(); - return static_cast(v.data.arrayedInfoEncoding); - } - void setArrayedInfo(ImageArrayedInfo arrayedInfo) { - EnumPack v; - v.storage = getSubclassData(); - v.data.arrayedInfoEncoding = static_cast(arrayedInfo); - setSubclassData(v.storage); + return key == KeyTy(elementType, dim, depthInfo, arrayedInfo, samplingInfo, + samplerUseInfo, format); } - ImageSamplingInfo getSamplingInfo() const { - EnumPack v; - v.storage = getSubclassData(); - return static_cast(v.data.samplingInfoEncoding); - } - void setSamplingInfo(ImageSamplingInfo samplingInfo) { - EnumPack v; - v.storage = getSubclassData(); - v.data.samplingInfoEncoding = static_cast(samplingInfo); - setSubclassData(v.storage); - } - - ImageSamplerUseInfo getSamplerUseInfo() const { - EnumPack v; - v.storage = getSubclassData(); - return static_cast(v.data.samplerUseInfoEncoding); - } - void setSamplerUseInfo(ImageSamplerUseInfo samplerUseInfo) { - EnumPack v; - v.storage = getSubclassData(); - v.data.samplerUseInfoEncoding = static_cast(samplerUseInfo); - setSubclassData(v.storage); - } - - ImageFormat getImageFormat() const { - EnumPack v; - v.storage = getSubclassData(); - return static_cast(v.data.formatEncoding); - } - void setImageFormat(ImageFormat format) { - EnumPack v; - v.storage = getSubclassData(); - v.data.formatEncoding = static_cast(format); - setSubclassData(v.storage); - } - - ImageTypeStorage(const KeyTy &key) : elementType(std::get<0>(key)) { - static_assert(sizeof(EnumPack) <= sizeof(getSubclassData()), - "EnumPack size greater than subClassData type size"); - setDim(std::get<1>(key)); - setDepthInfo(std::get<2>(key)); - setArrayedInfo(std::get<3>(key)); - setSamplingInfo(std::get<4>(key)); - setSamplerUseInfo(std::get<5>(key)); - setImageFormat(std::get<6>(key)); - } + ImageTypeStorage(const KeyTy &key) + : elementType(std::get<0>(key)), dim(std::get<1>(key)), + depthInfo(std::get<2>(key)), arrayedInfo(std::get<3>(key)), + samplingInfo(std::get<4>(key)), samplerUseInfo(std::get<5>(key)), + format(std::get<6>(key)) {} Type elementType; + Dim dim : getNumBits(); + ImageDepthInfo depthInfo : getNumBits(); + ImageArrayedInfo arrayedInfo : getNumBits(); + ImageSamplingInfo samplingInfo : getNumBits(); + ImageSamplerUseInfo samplerUseInfo : getNumBits(); + ImageFormat format : getNumBits(); }; ImageType @@ -536,27 +445,23 @@ ImageType::get(std::tupleelementType; } -Dim ImageType::getDim() const { return getImpl()->getDim(); } +Dim ImageType::getDim() const { return getImpl()->dim; } -ImageDepthInfo ImageType::getDepthInfo() const { - return getImpl()->getDepthInfo(); -} +ImageDepthInfo ImageType::getDepthInfo() const { return getImpl()->depthInfo; } ImageArrayedInfo ImageType::getArrayedInfo() const { - return getImpl()->getArrayedInfo(); + return getImpl()->arrayedInfo; } ImageSamplingInfo ImageType::getSamplingInfo() const { - return getImpl()->getSamplingInfo(); + return getImpl()->samplingInfo; } ImageSamplerUseInfo ImageType::getSamplerUseInfo() const { - return getImpl()->getSamplerUseInfo(); + return getImpl()->samplerUseInfo; } -ImageFormat ImageType::getImageFormat() const { - return getImpl()->getImageFormat(); -} +ImageFormat ImageType::getImageFormat() const { return getImpl()->format; } void ImageType::getExtensions(SPIRVType::ExtensionArrayRefVector &, Optional) { @@ -588,18 +493,14 @@ struct spirv::detail::PointerTypeStorage : public TypeStorage { } bool operator==(const KeyTy &key) const { - return key == KeyTy(pointeeType, getStorageClass()); + return key == KeyTy(pointeeType, storageClass); } PointerTypeStorage(const KeyTy &key) - : TypeStorage(static_cast(key.second)), pointeeType(key.first) { - } - - StorageClass getStorageClass() const { - return static_cast(getSubclassData()); - } + : pointeeType(key.first), storageClass(key.second) {} Type pointeeType; + StorageClass storageClass; }; PointerType PointerType::get(Type pointeeType, StorageClass storageClass) { @@ -610,7 +511,7 @@ PointerType PointerType::get(Type pointeeType, StorageClass storageClass) { Type PointerType::getPointeeType() const { return getImpl()->pointeeType; } StorageClass PointerType::getStorageClass() const { - return getImpl()->getStorageClass(); + return getImpl()->storageClass; } void PointerType::getExtensions(SPIRVType::ExtensionArrayRefVector &extensions, @@ -650,13 +551,14 @@ struct spirv::detail::RuntimeArrayTypeStorage : public TypeStorage { } bool operator==(const KeyTy &key) const { - return key == KeyTy(elementType, getSubclassData()); + return key == KeyTy(elementType, stride); } RuntimeArrayTypeStorage(const KeyTy &key) - : TypeStorage(key.second), elementType(key.first) {} + : elementType(key.first), stride(key.second) {} Type elementType; + unsigned stride; }; RuntimeArrayType RuntimeArrayType::get(Type elementType) { @@ -671,9 +573,7 @@ RuntimeArrayType RuntimeArrayType::get(Type elementType, unsigned stride) { Type RuntimeArrayType::getElementType() const { return getImpl()->elementType; } -unsigned RuntimeArrayType::getArrayStride() const { - return getImpl()->getSubclassData(); -} +unsigned RuntimeArrayType::getArrayStride() const { return getImpl()->stride; } void RuntimeArrayType::getExtensions( SPIRVType::ExtensionArrayRefVector &extensions, @@ -921,8 +821,8 @@ struct spirv::detail::StructTypeStorage : public TypeStorage { unsigned numMembers, Type const *memberTypes, StructType::OffsetInfo const *layoutInfo, unsigned numMemberDecorations, StructType::MemberDecorationInfo const *memberDecorationsInfo) - : TypeStorage(numMembers), memberTypes(memberTypes), - offsetInfo(layoutInfo), numMemberDecorations(numMemberDecorations), + : memberTypes(memberTypes), offsetInfo(layoutInfo), + numMembers(numMembers), numMemberDecorations(numMemberDecorations), memberDecorationsInfo(memberDecorationsInfo) {} using KeyTy = std::tuple, ArrayRef, @@ -964,12 +864,12 @@ struct spirv::detail::StructTypeStorage : public TypeStorage { } ArrayRef getMemberTypes() const { - return ArrayRef(memberTypes, getSubclassData()); + return ArrayRef(memberTypes, numMembers); } ArrayRef getOffsetInfo() const { if (offsetInfo) { - return ArrayRef(offsetInfo, getSubclassData()); + return ArrayRef(offsetInfo, numMembers); } return {}; } @@ -984,6 +884,7 @@ struct spirv::detail::StructTypeStorage : public TypeStorage { Type const *memberTypes; StructType::OffsetInfo const *offsetInfo; + unsigned numMembers; unsigned numMemberDecorations; StructType::MemberDecorationInfo const *memberDecorationsInfo; }; @@ -1007,9 +908,7 @@ StructType StructType::getEmpty(MLIRContext *context) { ArrayRef()); } -unsigned StructType::getNumElements() const { - return getImpl()->getSubclassData(); -} +unsigned StructType::getNumElements() const { return getImpl()->numMembers; } Type StructType::getElementType(unsigned index) const { assert(getNumElements() > index && "member index out of range"); diff --git a/mlir/lib/IR/StandardTypes.cpp b/mlir/lib/IR/StandardTypes.cpp index f4bb79362ffd35..0cc82477d380f3 100644 --- a/mlir/lib/IR/StandardTypes.cpp +++ b/mlir/lib/IR/StandardTypes.cpp @@ -130,10 +130,10 @@ IntegerType::verifyConstructionInvariants(Location loc, unsigned width, return success(); } -unsigned IntegerType::getWidth() const { return getImpl()->getWidth(); } +unsigned IntegerType::getWidth() const { return getImpl()->width; } IntegerType::SignednessSemantics IntegerType::getSignedness() const { - return getImpl()->getSignedness(); + return getImpl()->signedness; } //===----------------------------------------------------------------------===// diff --git a/mlir/lib/IR/TypeDetail.h b/mlir/lib/IR/TypeDetail.h index 783983473a3882..b5019f00d22247 100644 --- a/mlir/lib/IR/TypeDetail.h +++ b/mlir/lib/IR/TypeDetail.h @@ -56,17 +56,17 @@ struct OpaqueTypeStorage : public TypeStorage { struct IntegerTypeStorage : public TypeStorage { IntegerTypeStorage(unsigned width, IntegerType::SignednessSemantics signedness) - : TypeStorage(packKeyBits(width, signedness)) {} + : width(width), signedness(signedness) {} /// The hash key used for uniquing. using KeyTy = std::pair; static llvm::hash_code hashKey(const KeyTy &key) { - return llvm::hash_value(packKeyBits(key.first, key.second)); + return llvm::hash_value(key); } bool operator==(const KeyTy &key) const { - return getSubclassData() == packKeyBits(key.first, key.second); + return KeyTy(width, signedness) == key; } static IntegerTypeStorage *construct(TypeStorageAllocator &allocator, @@ -75,35 +75,15 @@ struct IntegerTypeStorage : public TypeStorage { IntegerTypeStorage(key.first, key.second); } - struct KeyBits { - unsigned width : 30; - unsigned signedness : 2; - }; - - /// Pack the given `width` and `signedness` as a key. - static unsigned packKeyBits(unsigned width, - IntegerType::SignednessSemantics signedness) { - KeyBits bits{width, static_cast(signedness)}; - return llvm::bit_cast(bits); - } - - static KeyBits unpackKeyBits(unsigned bits) { - return llvm::bit_cast(bits); - } - - unsigned getWidth() { return unpackKeyBits(getSubclassData()).width; } - - IntegerType::SignednessSemantics getSignedness() { - return static_cast( - unpackKeyBits(getSubclassData()).signedness); - } + unsigned width : 30; + IntegerType::SignednessSemantics signedness : 2; }; /// Function Type Storage and Uniquing. struct FunctionTypeStorage : public TypeStorage { FunctionTypeStorage(unsigned numInputs, unsigned numResults, Type const *inputsAndResults) - : TypeStorage(numInputs), numResults(numResults), + : numInputs(numInputs), numResults(numResults), inputsAndResults(inputsAndResults) {} /// The hash key used for uniquing. @@ -130,20 +110,20 @@ struct FunctionTypeStorage : public TypeStorage { } ArrayRef getInputs() const { - return ArrayRef(inputsAndResults, getSubclassData()); + return ArrayRef(inputsAndResults, numInputs); } ArrayRef getResults() const { - return ArrayRef(inputsAndResults + getSubclassData(), numResults); + return ArrayRef(inputsAndResults + numInputs, numResults); } + unsigned numInputs; unsigned numResults; Type const *inputsAndResults; }; /// Shaped Type Storage. struct ShapedTypeStorage : public TypeStorage { - ShapedTypeStorage(Type elementTy, unsigned subclassData = 0) - : TypeStorage(subclassData), elementType(elementTy) {} + ShapedTypeStorage(Type elementTy) : elementType(elementTy) {} /// The hash key used for uniquing. using KeyTy = Type; @@ -156,7 +136,8 @@ struct ShapedTypeStorage : public TypeStorage { struct VectorTypeStorage : public ShapedTypeStorage { VectorTypeStorage(unsigned shapeSize, Type elementTy, const int64_t *shapeElements) - : ShapedTypeStorage(elementTy, shapeSize), shapeElements(shapeElements) {} + : ShapedTypeStorage(elementTy), shapeElements(shapeElements), + shapeSize(shapeSize) {} /// The hash key used for uniquing. using KeyTy = std::pair, Type>; @@ -176,16 +157,18 @@ struct VectorTypeStorage : public ShapedTypeStorage { } ArrayRef getShape() const { - return ArrayRef(shapeElements, getSubclassData()); + return ArrayRef(shapeElements, shapeSize); } const int64_t *shapeElements; + unsigned shapeSize; }; struct RankedTensorTypeStorage : public ShapedTypeStorage { RankedTensorTypeStorage(unsigned shapeSize, Type elementTy, const int64_t *shapeElements) - : ShapedTypeStorage(elementTy, shapeSize), shapeElements(shapeElements) {} + : ShapedTypeStorage(elementTy), shapeElements(shapeElements), + shapeSize(shapeSize) {} /// The hash key used for uniquing. using KeyTy = std::pair, Type>; @@ -205,10 +188,11 @@ struct RankedTensorTypeStorage : public ShapedTypeStorage { } ArrayRef getShape() const { - return ArrayRef(shapeElements, getSubclassData()); + return ArrayRef(shapeElements, shapeSize); } const int64_t *shapeElements; + unsigned shapeSize; }; struct UnrankedTensorTypeStorage : public ShapedTypeStorage { @@ -227,9 +211,9 @@ struct MemRefTypeStorage : public ShapedTypeStorage { MemRefTypeStorage(unsigned shapeSize, Type elementType, const int64_t *shapeElements, const unsigned numAffineMaps, AffineMap const *affineMapList, const unsigned memorySpace) - : ShapedTypeStorage(elementType, shapeSize), shapeElements(shapeElements), - numAffineMaps(numAffineMaps), affineMapList(affineMapList), - memorySpace(memorySpace) {} + : ShapedTypeStorage(elementType), shapeElements(shapeElements), + shapeSize(shapeSize), numAffineMaps(numAffineMaps), + affineMapList(affineMapList), memorySpace(memorySpace) {} /// The hash key used for uniquing. // MemRefs are uniqued based on their shape, element type, affine map @@ -258,7 +242,7 @@ struct MemRefTypeStorage : public ShapedTypeStorage { } ArrayRef getShape() const { - return ArrayRef(shapeElements, getSubclassData()); + return ArrayRef(shapeElements, shapeSize); } ArrayRef getAffineMaps() const { @@ -267,6 +251,8 @@ struct MemRefTypeStorage : public ShapedTypeStorage { /// An array of integers which stores the shape dimension sizes. const int64_t *shapeElements; + /// The number of shape elements. + unsigned shapeSize; /// The number of affine maps in the 'affineMapList' array. const unsigned numAffineMaps; /// List of affine maps in the memref's layout/index map composition. @@ -324,7 +310,7 @@ struct TupleTypeStorage final public llvm::TrailingObjects { using KeyTy = TypeRange; - TupleTypeStorage(unsigned numTypes) : TypeStorage(numTypes) {} + TupleTypeStorage(unsigned numTypes) : numElements(numTypes) {} /// Construction. static TupleTypeStorage *construct(TypeStorageAllocator &allocator, @@ -343,12 +329,15 @@ struct TupleTypeStorage final bool operator==(const KeyTy &key) const { return key == getTypes(); } /// Return the number of held types. - unsigned size() const { return getSubclassData(); } + unsigned size() const { return numElements; } /// Return the held types. ArrayRef getTypes() const { return {getTrailingObjects(), size()}; } + + /// The number of tuple elements. + unsigned numElements; }; } // namespace detail diff --git a/mlir/lib/IR/Types.cpp b/mlir/lib/IR/Types.cpp index fea2cc6648e3c7..ae2dd909ff59a1 100644 --- a/mlir/lib/IR/Types.cpp +++ b/mlir/lib/IR/Types.cpp @@ -27,9 +27,6 @@ Dialect &Type::getDialect() const { MLIRContext *Type::getContext() const { return getDialect().getContext(); } -unsigned Type::getSubclassData() const { return impl->getSubclassData(); } -void Type::setSubclassData(unsigned val) { impl->setSubclassData(val); } - //===----------------------------------------------------------------------===// // FunctionType //===----------------------------------------------------------------------===// @@ -39,6 +36,8 @@ FunctionType FunctionType::get(TypeRange inputs, TypeRange results, return Base::get(context, Type::Kind::Function, inputs, results); } +unsigned FunctionType::getNumInputs() const { return getImpl()->numInputs; } + ArrayRef FunctionType::getInputs() const { return getImpl()->getInputs(); } From 1d6a8deb41221f73c57b57fe9add180da34af77f Mon Sep 17 00:00:00 2001 From: River Riddle Date: Fri, 7 Aug 2020 13:30:17 -0700 Subject: [PATCH 12/26] [mlir] Remove the need to define `kindof` on attribute and type classes. This revision refactors the default definition of the attribute and type `classof` methods to use the TypeID of the concrete class instead of invoking the `kindof` method. The TypeID is already used as part of uniquing, and this allows for removing the need for users to define any of the type casting utilities themselves. Differential Revision: https://reviews.llvm.org/D85356 --- .../include/flang/Optimizer/Dialect/FIRAttr.h | 7 -- .../include/flang/Optimizer/Dialect/FIRType.h | 16 ---- .../Tutorials/DefiningAttributesAndTypes.md | 12 --- mlir/docs/Tutorials/Toy/Ch-7.md | 4 - mlir/examples/toy/Ch7/include/toy/Dialect.h | 4 - mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h | 47 +++--------- .../mlir/Dialect/Linalg/IR/LinalgTypes.h | 2 - mlir/include/mlir/Dialect/Quant/QuantTypes.h | 13 ---- .../mlir/Dialect/SPIRV/SPIRVAttributes.h | 8 -- mlir/include/mlir/Dialect/SPIRV/SPIRVTypes.h | 16 ---- mlir/include/mlir/Dialect/Shape/IR/Shape.h | 26 ------- mlir/include/mlir/IR/AttributeSupport.h | 14 +++- mlir/include/mlir/IR/Attributes.h | 73 +------------------ mlir/include/mlir/IR/Location.h | 30 -------- mlir/include/mlir/IR/StandardTypes.h | 34 --------- mlir/include/mlir/IR/StorageUniquerSupport.h | 9 +-- mlir/include/mlir/IR/TypeSupport.h | 14 +++- mlir/include/mlir/IR/Types.h | 15 +--- mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp | 7 +- mlir/lib/IR/MLIRContext.cpp | 1 - mlir/test/lib/Dialect/Test/TestTypes.h | 8 -- 21 files changed, 49 insertions(+), 311 deletions(-) diff --git a/flang/include/flang/Optimizer/Dialect/FIRAttr.h b/flang/include/flang/Optimizer/Dialect/FIRAttr.h index 0b22bc21224cbf..e9b16909f3fb25 100644 --- a/flang/include/flang/Optimizer/Dialect/FIRAttr.h +++ b/flang/include/flang/Optimizer/Dialect/FIRAttr.h @@ -48,7 +48,6 @@ class ExactTypeAttr mlir::Type getType() const; - static constexpr bool kindof(unsigned kind) { return kind == getId(); } static constexpr unsigned getId() { return AttributeKind::FIR_EXACTTYPE; } }; @@ -64,7 +63,6 @@ class SubclassAttr mlir::Type getType() const; - static constexpr bool kindof(unsigned kind) { return kind == getId(); } static constexpr unsigned getId() { return AttributeKind::FIR_SUBCLASS; } }; @@ -82,7 +80,6 @@ class ClosedIntervalAttr static constexpr llvm::StringRef getAttrName() { return "interval"; } static ClosedIntervalAttr get(mlir::MLIRContext *ctxt); - static constexpr bool kindof(unsigned kind) { return kind == getId(); } static constexpr unsigned getId() { return AttributeKind::FIR_CLOSEDCLOSED_INTERVAL; } @@ -100,7 +97,6 @@ class UpperBoundAttr static constexpr llvm::StringRef getAttrName() { return "upper"; } static UpperBoundAttr get(mlir::MLIRContext *ctxt); - static constexpr bool kindof(unsigned kind) { return kind == getId(); } static constexpr unsigned getId() { return AttributeKind::FIR_OPENCLOSED_INTERVAL; } @@ -118,7 +114,6 @@ class LowerBoundAttr static constexpr llvm::StringRef getAttrName() { return "lower"; } static LowerBoundAttr get(mlir::MLIRContext *ctxt); - static constexpr bool kindof(unsigned kind) { return kind == getId(); } static constexpr unsigned getId() { return AttributeKind::FIR_CLOSEDOPEN_INTERVAL; } @@ -136,7 +131,6 @@ class PointIntervalAttr static constexpr llvm::StringRef getAttrName() { return "point"; } static PointIntervalAttr get(mlir::MLIRContext *ctxt); - static constexpr bool kindof(unsigned kind) { return kind == getId(); } static constexpr unsigned getId() { return AttributeKind::FIR_POINT; } }; @@ -157,7 +151,6 @@ class RealAttr int getFKind() const; llvm::APFloat getValue() const; - static constexpr bool kindof(unsigned kind) { return kind == getId(); } static constexpr unsigned getId() { return AttributeKind::FIR_REAL_ATTR; } }; diff --git a/flang/include/flang/Optimizer/Dialect/FIRType.h b/flang/include/flang/Optimizer/Dialect/FIRType.h index b1f1cc85b744ad..3d3125c97e9304 100644 --- a/flang/include/flang/Optimizer/Dialect/FIRType.h +++ b/flang/include/flang/Optimizer/Dialect/FIRType.h @@ -114,7 +114,6 @@ mlir::Type dyn_cast_ptrEleTy(mlir::Type t); /// Boilerplate mixin template template struct IntrinsicTypeMixin { - static constexpr bool kindof(unsigned kind) { return kind == getId(); } static constexpr unsigned getId() { return Id; } }; @@ -194,7 +193,6 @@ class BoxType public: using Base::Base; static BoxType get(mlir::Type eleTy, mlir::AffineMapAttr map = {}); - static bool kindof(unsigned kind) { return kind == TypeKind::FIR_BOX; } mlir::Type getEleTy() const; mlir::AffineMapAttr getLayoutMap() const; @@ -211,7 +209,6 @@ class BoxCharType : public mlir::Type::TypeBase lenPList, llvm::ArrayRef typeList); - static constexpr bool kindof(unsigned kind) { return kind == getId(); } static constexpr unsigned getId() { return TypeKind::FIR_DERIVED; } detail::RecordTypeStorage const *uniqueKey() const; diff --git a/mlir/docs/Tutorials/DefiningAttributesAndTypes.md b/mlir/docs/Tutorials/DefiningAttributesAndTypes.md index 45756e1a31eab3..13cd75d9126116 100644 --- a/mlir/docs/Tutorials/DefiningAttributesAndTypes.md +++ b/mlir/docs/Tutorials/DefiningAttributesAndTypes.md @@ -89,10 +89,6 @@ public: /// Inherit some necessary constructors from 'TypeBase'. using Base::Base; - /// This static method is used to support type inquiry through isa, cast, - /// and dyn_cast. - static bool kindof(unsigned kind) { return kind == MyTypes::Simple; } - /// This method is used to get an instance of the 'SimpleType'. Given that /// this is a parameterless type, it just needs to take the context for /// uniquing purposes. @@ -193,10 +189,6 @@ public: /// Inherit some necessary constructors from 'TypeBase'. using Base::Base; - /// This static method is used to support type inquiry through isa, cast, - /// and dyn_cast. - static bool kindof(unsigned kind) { return kind == MyTypes::Complex; } - /// This method is used to get an instance of the 'ComplexType'. This method /// asserts that all of the construction invariants were satisfied. To /// gracefully handle failed construction, getChecked should be used instead. @@ -327,10 +319,6 @@ public: /// Inherit parent constructors. using Base::Base; - /// This static method is used to support type inquiry through isa, cast, - /// and dyn_cast. - static bool kindof(unsigned kind) { return kind == MyTypes::Recursive; } - /// Creates an instance of the Recursive type. This only takes the type name /// and returns the type with uninitialized body. static RecursiveType get(MLIRContext *ctx, StringRef name) { diff --git a/mlir/docs/Tutorials/Toy/Ch-7.md b/mlir/docs/Tutorials/Toy/Ch-7.md index 733e22c5b0a554..cbab1e1cadb0cf 100644 --- a/mlir/docs/Tutorials/Toy/Ch-7.md +++ b/mlir/docs/Tutorials/Toy/Ch-7.md @@ -184,10 +184,6 @@ public: /// Inherit some necessary constructors from 'TypeBase'. using Base::Base; - /// This static method is used to support type inquiry through isa, cast, - /// and dyn_cast. - static bool kindof(unsigned kind) { return kind == ToyTypes::Struct; } - /// Create an instance of a `StructType` with the given element types. There /// *must* be at least one element type. static StructType get(llvm::ArrayRef elementTypes) { diff --git a/mlir/examples/toy/Ch7/include/toy/Dialect.h b/mlir/examples/toy/Ch7/include/toy/Dialect.h index da6e9553d30b09..b695169924012a 100644 --- a/mlir/examples/toy/Ch7/include/toy/Dialect.h +++ b/mlir/examples/toy/Ch7/include/toy/Dialect.h @@ -81,10 +81,6 @@ class StructType : public mlir::Type::TypeBase elementTypes); diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h b/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h index 0d3a6f3249b163..32ec77ad63e4f1 100644 --- a/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h +++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h @@ -61,7 +61,7 @@ class LLVMIntegerType; /// Similarly to other MLIR types, LLVM dialect types are owned by the MLIR /// context, have an immutable identifier (for most types except identified /// structs, the entire type is the identifier) and are thread-safe. -class LLVMType : public Type::TypeBase { +class LLVMType : public Type { public: enum Kind { // Keep non-parametric types contiguous in the enum. @@ -92,7 +92,7 @@ class LLVMType : public Type::TypeBase { }; /// Inherit base constructors. - using Base::Base; + using Type::Type; /// Support for PointerLikeTypeTraits. using Type::getAsOpaquePointer; @@ -101,8 +101,9 @@ class LLVMType : public Type::TypeBase { } /// Support for isa/cast. - static bool kindof(unsigned kind) { - return FIRST_NEW_LLVM_TYPE <= kind && kind <= LAST_NEW_LLVM_TYPE; + static bool classof(Type type) { + return type.getKind() >= FIRST_NEW_LLVM_TYPE && + type.getKind() <= LAST_NEW_LLVM_TYPE; } LLVMDialect &getDialect(); @@ -256,7 +257,6 @@ class LLVMType : public Type::TypeBase { class ClassName : public Type::TypeBase { \ public: \ using Base::Base; \ - static bool kindof(unsigned kind) { return kind == Kind; } \ static ClassName get(MLIRContext *context) { \ return Base::get(context, Kind); \ } \ @@ -290,9 +290,6 @@ class LLVMArrayType : public Type::TypeBase arguments, @@ -354,9 +348,6 @@ class LLVMIntegerType : public Type::TypeBase { +class LLVMVectorType : public LLVMType { public: /// Inherit base constructor. - using Base::Base; + using LLVMType::LLVMType; - /// Support for isa/cast. - static bool kindof(unsigned kind) { - return kind == LLVMType::FixedVectorType || - kind == LLVMType::ScalableVectorType; - } + /// Support type casting functionality. + static bool classof(Type type); /// Returns the element type of the vector. LLVMType getElementType(); @@ -517,11 +498,6 @@ class LLVMFixedVectorType /// Inherit base constructor. using Base::Base; - /// Support for isa/cast. - static bool kindof(unsigned kind) { - return kind == LLVMType::FixedVectorType; - } - /// Gets or creates a fixed vector type containing `numElements` of /// `elementType` in the same context as `elementType`. static LLVMFixedVectorType get(LLVMType elementType, unsigned numElements); @@ -544,11 +520,6 @@ class LLVMScalableVectorType /// Inherit base constructor. using Base::Base; - /// Support for isa/cast. - static bool kindof(unsigned kind) { - return kind == LLVMType::ScalableVectorType; - } - /// Gets or creates a scalable vector type containing a non-zero multiple of /// `minNumElements` of `elementType` in the same context as `elementType`. static LLVMScalableVectorType get(LLVMType elementType, diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgTypes.h b/mlir/include/mlir/Dialect/Linalg/IR/LinalgTypes.h index 9f23e64e7c5d0f..17e803db82114c 100644 --- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgTypes.h +++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgTypes.h @@ -41,8 +41,6 @@ class RangeType : public Type::TypeBase { /// Custom, uniq'ed construction in the MLIRContext. return Base::get(context, LinalgTypes::Range); } - /// Used to implement llvm-style cast. - static bool kindof(unsigned kind) { return kind == LinalgTypes::Range; } }; } // namespace linalg diff --git a/mlir/include/mlir/Dialect/Quant/QuantTypes.h b/mlir/include/mlir/Dialect/Quant/QuantTypes.h index 6062da0a0d5b6a..689ac49163ebea 100644 --- a/mlir/include/mlir/Dialect/Quant/QuantTypes.h +++ b/mlir/include/mlir/Dialect/Quant/QuantTypes.h @@ -211,9 +211,6 @@ class AnyQuantizedType public: using Base::Base; - /// Support method to enable LLVM-style type casting. - static bool kindof(unsigned kind) { return kind == QuantizationTypes::Any; } - /// Gets an instance of the type with all parameters specified but not /// checked. static AnyQuantizedType get(unsigned flags, Type storageType, @@ -292,11 +289,6 @@ class UniformQuantizedType int64_t zeroPoint, int64_t storageTypeMin, int64_t storageTypeMax); - /// Support method to enable LLVM-style type casting. - static bool kindof(unsigned kind) { - return kind == QuantizationTypes::UniformQuantized; - } - /// Gets the scale term. The scale designates the difference between the real /// values corresponding to consecutive quantized values differing by 1. double getScale() const; @@ -357,11 +349,6 @@ class UniformQuantizedPerAxisType int32_t quantizedDimension, int64_t storageTypeMin, int64_t storageTypeMax); - /// Support method to enable LLVM-style type casting. - static bool kindof(unsigned kind) { - return kind == QuantizationTypes::UniformQuantizedPerAxis; - } - /// Gets the quantization scales. The scales designate the difference between /// the real values corresponding to consecutive quantized values differing /// by 1. The ith scale corresponds to the ith slice in the diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVAttributes.h b/mlir/include/mlir/Dialect/SPIRV/SPIRVAttributes.h index 36344b41d6cb28..6788d5952cd47b 100644 --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVAttributes.h +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVAttributes.h @@ -68,10 +68,6 @@ class InterfaceVarABIAttr /// Returns `spirv::StorageClass`. Optional getStorageClass(); - static bool kindof(unsigned kind) { - return kind == AttrKind::InterfaceVarABI; - } - static LogicalResult verifyConstructionInvariants(Location loc, IntegerAttr descriptorSet, IntegerAttr binding, @@ -123,8 +119,6 @@ class VerCapExtAttr /// Returns the capabilities as an integer array attribute. ArrayAttr getCapabilitiesAttr(); - static bool kindof(unsigned kind) { return kind == AttrKind::VerCapExt; } - static LogicalResult verifyConstructionInvariants(Location loc, IntegerAttr version, ArrayAttr capabilities, @@ -165,8 +159,6 @@ class TargetEnvAttr /// Returns the target resource limits. ResourceLimitsAttr getResourceLimits(); - static bool kindof(unsigned kind) { return kind == AttrKind::TargetEnv; } - static LogicalResult verifyConstructionInvariants(Location loc, VerCapExtAttr triple, DictionaryAttr limits); diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVTypes.h b/mlir/include/mlir/Dialect/SPIRV/SPIRVTypes.h index b13d3c7892be59..a9d120b5d114a0 100644 --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVTypes.h +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVTypes.h @@ -170,8 +170,6 @@ class ArrayType : public Type::TypeBase memberTypes, ArrayRef offsetInfo = {}, @@ -385,10 +375,6 @@ class CooperativeMatrixNVType public: using Base::Base; - static bool kindof(unsigned kind) { - return kind == TypeKind::CooperativeMatrix; - } - static CooperativeMatrixNVType get(Type elementType, spirv::Scope scope, unsigned rows, unsigned columns); Type getElementType() const; @@ -412,8 +398,6 @@ class MatrixType : public Type::TypeBase { static ComponentType get(MLIRContext *context) { return Base::get(context, ShapeTypes::Kind::Component); } - - /// Support method to enable LLVM-style type casting. - static bool kindof(unsigned kind) { - return kind == ShapeTypes::Kind::Component; - } }; /// The element type of the shaped type. @@ -64,11 +59,6 @@ class ElementType : public Type::TypeBase { static ElementType get(MLIRContext *context) { return Base::get(context, ShapeTypes::Kind::Element); } - - /// Support method to enable LLVM-style type casting. - static bool kindof(unsigned kind) { - return kind == ShapeTypes::Kind::Element; - } }; /// The shape descriptor type represents rank and dimension sizes. @@ -79,9 +69,6 @@ class ShapeType : public Type::TypeBase { static ShapeType get(MLIRContext *context) { return Base::get(context, ShapeTypes::Kind::Shape); } - - /// Support method to enable LLVM-style type casting. - static bool kindof(unsigned kind) { return kind == ShapeTypes::Kind::Shape; } }; /// The type of a single dimension. @@ -92,9 +79,6 @@ class SizeType : public Type::TypeBase { static SizeType get(MLIRContext *context) { return Base::get(context, ShapeTypes::Kind::Size); } - - /// Support method to enable LLVM-style type casting. - static bool kindof(unsigned kind) { return kind == ShapeTypes::Kind::Size; } }; /// The ValueShape represents a (potentially unknown) runtime value and shape. @@ -106,11 +90,6 @@ class ValueShapeType static ValueShapeType get(MLIRContext *context) { return Base::get(context, ShapeTypes::Kind::ValueShape); } - - /// Support method to enable LLVM-style type casting. - static bool kindof(unsigned kind) { - return kind == ShapeTypes::Kind::ValueShape; - } }; /// The Witness represents a runtime constraint, to be used as shape related @@ -122,11 +101,6 @@ class WitnessType : public Type::TypeBase { static WitnessType get(MLIRContext *context) { return Base::get(context, ShapeTypes::Kind::Witness); } - - /// Support method to enable LLVM-style type casting. - static bool kindof(unsigned kind) { - return kind == ShapeTypes::Kind::Witness; - } }; #define GET_OP_CLASSES diff --git a/mlir/include/mlir/IR/AttributeSupport.h b/mlir/include/mlir/IR/AttributeSupport.h index 79ce1dd2db9542..31e6285164ab21 100644 --- a/mlir/include/mlir/IR/AttributeSupport.h +++ b/mlir/include/mlir/IR/AttributeSupport.h @@ -36,7 +36,7 @@ class AbstractAttribute { /// This method is used by Dialect objects when they register the list of /// attributes they contain. template static AbstractAttribute get(Dialect &dialect) { - return AbstractAttribute(dialect, T::getInterfaceMap()); + return AbstractAttribute(dialect, T::getInterfaceMap(), T::getTypeID()); } /// Return the dialect this attribute was registered to. @@ -49,15 +49,23 @@ class AbstractAttribute { return interfaceMap.lookup(); } + /// Return the unique identifier representing the concrete attribute class. + TypeID getTypeID() const { return typeID; } + private: - AbstractAttribute(Dialect &dialect, detail::InterfaceMap &&interfaceMap) - : dialect(dialect), interfaceMap(std::move(interfaceMap)) {} + AbstractAttribute(Dialect &dialect, detail::InterfaceMap &&interfaceMap, + TypeID typeID) + : dialect(dialect), interfaceMap(std::move(interfaceMap)), + typeID(typeID) {} /// This is the dialect that this attribute was registered to. Dialect &dialect; /// This is a collection of the interfaces registered to this attribute. detail::InterfaceMap interfaceMap; + + /// The unique identifier of the derived Attribute class. + TypeID typeID; }; //===----------------------------------------------------------------------===// diff --git a/mlir/include/mlir/IR/Attributes.h b/mlir/include/mlir/IR/Attributes.h index 5ecf5763ecd47a..a57adb315bc3af 100644 --- a/mlir/include/mlir/IR/Attributes.h +++ b/mlir/include/mlir/IR/Attributes.h @@ -97,6 +97,10 @@ class Attribute { /// Return the classification for this attribute. unsigned getKind() const { return impl->getKind(); } + /// Return a unique identifier for the concrete attribute type. This is used + /// to support dynamic type casting. + TypeID getTypeID() { return impl->getAbstractAttribute().getTypeID(); } + /// Return the type of this attribute. Type getType() const; @@ -231,11 +235,6 @@ class AffineMapAttr static AffineMapAttr get(AffineMap value); AffineMap getValue() const; - - /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool kindof(unsigned kind) { - return kind == StandardAttributes::AffineMap; - } }; //===----------------------------------------------------------------------===// @@ -262,11 +261,6 @@ class ArrayAttr : public Attribute::AttrBase @@ -357,11 +351,6 @@ class DictionaryAttr /// Requires: uniquely named attributes. static bool sortInPlace(SmallVectorImpl &array); - /// Methods for supporting type inquiry through isa, cast, and dyn_cast. - static bool kindof(unsigned kind) { - return kind == StandardAttributes::Dictionary; - } - private: /// Return empty dictionary. static DictionaryAttr getEmpty(MLIRContext *context); @@ -394,11 +383,6 @@ class FloatAttr : public Attribute::AttrBase getNestedReferences() const; - - /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool kindof(unsigned kind) { - return kind == StandardAttributes::SymbolRef; - } }; /// A symbol reference with a reference path containing a single element. This @@ -630,9 +590,6 @@ class TypeAttr : public Attribute::AttrBase index) const; - /// Method for support type inquiry through isa, cast and dyn_cast. - static bool kindof(unsigned kind) { - return kind == StandardAttributes::SparseElements; - } - private: /// Get a zero APFloat for the given sparse attribute. APFloat getZeroAPFloat() const; diff --git a/mlir/include/mlir/IR/Location.h b/mlir/include/mlir/IR/Location.h index c1b6dd016db779..5bbf003a427110 100644 --- a/mlir/include/mlir/IR/Location.h +++ b/mlir/include/mlir/IR/Location.h @@ -120,11 +120,6 @@ class CallSiteLoc /// The caller's location. Location getCaller() const; - - /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool kindof(unsigned kind) { - return kind == StandardAttributes::CallSiteLocation; - } }; /// Represents a location derived from a file/line/column location. The column @@ -146,11 +141,6 @@ class FileLineColLoc unsigned getLine() const; unsigned getColumn() const; - - /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool kindof(unsigned kind) { - return kind == StandardAttributes::FileLineColLocation; - } }; /// Represents a value composed of multiple source constructs, with an optional @@ -174,11 +164,6 @@ class FusedLoc : public Attribute::AttrBase { /// Get an instance of the IndexType. static IndexType get(MLIRContext *context); - /// Support method to enable LLVM-style type casting. - static bool kindof(unsigned kind) { return kind == StandardTypes::Index; } - /// Storage bit width used for IndexType by internal compiler data structures. static constexpr unsigned kInternalStorageBitWidth = 64; }; @@ -177,9 +172,6 @@ class IntegerType /// Return true if this is an unsigned integer type. bool isUnsigned() const { return getSignedness() == Unsigned; } - /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool kindof(unsigned kind) { return kind == StandardTypes::Integer; } - /// Integer representation maximal bitwidth. static constexpr unsigned kMaxWidth = 4096; }; @@ -208,12 +200,6 @@ class FloatType : public Type::TypeBase { return get(StandardTypes::F64, ctx); } - /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool kindof(unsigned kind) { - return kind >= StandardTypes::FIRST_FLOATING_POINT_TYPE && - kind <= StandardTypes::LAST_FLOATING_POINT_TYPE; - } - /// Return the bitwidth of this float type. unsigned getWidth(); @@ -233,8 +219,6 @@ class NoneType : public Type::TypeBase { /// Get an instance of the NoneType. static NoneType get(MLIRContext *context); - - static bool kindof(unsigned kind) { return kind == StandardTypes::None; } }; //===----------------------------------------------------------------------===// @@ -361,9 +345,6 @@ class VectorType } ArrayRef getShape() const; - - /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool kindof(unsigned kind) { return kind == StandardTypes::Vector; } }; //===----------------------------------------------------------------------===// @@ -422,10 +403,6 @@ class RankedTensorType Type elementType); ArrayRef getShape() const; - - static bool kindof(unsigned kind) { - return kind == StandardTypes::RankedTensor; - } }; //===----------------------------------------------------------------------===// @@ -454,10 +431,6 @@ class UnrankedTensorType Type elementType); ArrayRef getShape() const { return llvm::None; } - - static bool kindof(unsigned kind) { - return kind == StandardTypes::UnrankedTensor; - } }; //===----------------------------------------------------------------------===// @@ -568,8 +541,6 @@ class MemRefType : public Type::TypeBase... { /// Return a unique identifier for the concrete type. static TypeID getTypeID() { return TypeID::get(); } - /// Provide a default implementation of 'classof' that invokes a 'kindof' - /// method on the concrete type. + /// Provide an implementation of 'classof' that compares the type id of the + /// provided value with that of the concerete type. template static bool classof(T val) { static_assert(std::is_convertible::value, "casting from a non-convertible type"); - return ConcreteT::kindof(val.getKind()); + return val.getTypeID() == getTypeID(); } /// Returns an interface map for the interfaces registered to this storage @@ -107,8 +107,7 @@ class StorageUserBase : public BaseT, public Traits... { /// Mutate the current storage instance. This will not change the unique key. /// The arguments are forwarded to 'ConcreteT::mutate'. - template - LogicalResult mutate(Args &&...args) { + template LogicalResult mutate(Args &&...args) { return UniquerT::template mutate(this->getContext(), getImpl(), std::forward(args)...); } diff --git a/mlir/include/mlir/IR/TypeSupport.h b/mlir/include/mlir/IR/TypeSupport.h index c26aec6411c00c..aa2daefd26c462 100644 --- a/mlir/include/mlir/IR/TypeSupport.h +++ b/mlir/include/mlir/IR/TypeSupport.h @@ -35,7 +35,7 @@ class AbstractType { /// This method is used by Dialect objects when they register the list of /// types they contain. template static AbstractType get(Dialect &dialect) { - return AbstractType(dialect, T::getInterfaceMap()); + return AbstractType(dialect, T::getInterfaceMap(), T::getTypeID()); } /// Return the dialect this type was registered to. @@ -48,15 +48,23 @@ class AbstractType { return interfaceMap.lookup(); } + /// Return the unique identifier representing the concrete type class. + TypeID getTypeID() const { return typeID; } + private: - AbstractType(Dialect &dialect, detail::InterfaceMap &&interfaceMap) - : dialect(dialect), interfaceMap(std::move(interfaceMap)) {} + AbstractType(Dialect &dialect, detail::InterfaceMap &&interfaceMap, + TypeID typeID) + : dialect(dialect), interfaceMap(std::move(interfaceMap)), + typeID(typeID) {} /// This is the dialect that this type was registered to. Dialect &dialect; /// This is a collection of the interfaces registered to this type. detail::InterfaceMap interfaceMap; + + /// The unique identifier of the derived Type class. + TypeID typeID; }; //===----------------------------------------------------------------------===// diff --git a/mlir/include/mlir/IR/Types.h b/mlir/include/mlir/IR/Types.h index bd0ea4bbd5dc0b..8101690daeb648 100644 --- a/mlir/include/mlir/IR/Types.h +++ b/mlir/include/mlir/IR/Types.h @@ -44,11 +44,6 @@ struct OpaqueTypeStorage; /// /// Derived type classes are expected to implement several required /// implementation hooks: -/// * Required: -/// - static bool kindof(unsigned kind); -/// * Returns if the provided type kind corresponds to an instance of the -/// current type. Used for isa/dyn_cast casting functionality. -/// /// * Optional: /// - static LogicalResult verifyConstructionInvariants(Location loc, /// Args... args) @@ -137,6 +132,10 @@ class Type { // Support type casting Type to itself. static bool classof(Type) { return true; } + /// Return a unique identifier for the concrete type. This is used to support + /// dynamic type casting. + TypeID getTypeID() { return impl->getAbstractType().getTypeID(); } + /// Return the classification for this type. unsigned getKind() const; @@ -262,7 +261,6 @@ class FunctionType // Input types. unsigned getNumInputs() const; - Type getInput(unsigned i) const { return getInputs()[i]; } ArrayRef getInputs() const; @@ -270,9 +268,6 @@ class FunctionType unsigned getNumResults() const; Type getResult(unsigned i) const { return getResults()[i]; } ArrayRef getResults() const; - - /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool kindof(unsigned kind) { return kind == Kind::Function; } }; //===----------------------------------------------------------------------===// @@ -307,8 +302,6 @@ class OpaqueType static LogicalResult verifyConstructionInvariants(Location loc, Identifier dialect, StringRef typeData); - - static bool kindof(unsigned kind) { return kind == Kind::Opaque; } }; // Make Type hashable. diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp index f8cadeb0c40fc7..ee429c1f73e3f2 100644 --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp @@ -322,6 +322,11 @@ ArrayRef LLVMStructType::getBody() { //===----------------------------------------------------------------------===// // Vector types. +/// Support type casting functionality. +bool LLVMVectorType::classof(Type type) { + return type.isa(); +} + LLVMType LLVMVectorType::getElementType() { // Both derived classes share the implementation type. return static_cast(impl)->elementType; @@ -331,7 +336,7 @@ llvm::ElementCount LLVMVectorType::getElementCount() { // Both derived classes share the implementation type. return llvm::ElementCount( static_cast(impl)->numElements, - this->isa()); + isa()); } LLVMFixedVectorType LLVMFixedVectorType::get(LLVMType elementType, diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp index 42c4d4855e503b..ace3553196597f 100644 --- a/mlir/lib/IR/MLIRContext.cpp +++ b/mlir/lib/IR/MLIRContext.cpp @@ -676,7 +676,6 @@ Identifier Identifier::get(StringRef str, MLIRContext *context) { StorageUniquer &MLIRContext::getTypeUniquer() { return getImpl().typeUniquer; } FloatType FloatType::get(StandardTypes::Kind kind, MLIRContext *context) { - assert(kindof(kind) && "Not a FP kind."); switch (kind) { case StandardTypes::BF16: return context->getImpl().bf16Ty; diff --git a/mlir/test/lib/Dialect/Test/TestTypes.h b/mlir/test/lib/Dialect/Test/TestTypes.h index 9e2c297c6a8927..1df16559167250 100644 --- a/mlir/test/lib/Dialect/Test/TestTypes.h +++ b/mlir/test/lib/Dialect/Test/TestTypes.h @@ -26,10 +26,6 @@ struct TestType : public Type::TypeBase { using Base::Base; - static bool kindof(unsigned kind) { - return kind == Type::Kind::FIRST_PRIVATE_EXPERIMENTAL_9_TYPE; - } - static TestType get(MLIRContext *context) { return Base::get(context, Type::Kind::FIRST_PRIVATE_EXPERIMENTAL_9_TYPE); } @@ -76,10 +72,6 @@ class TestRecursiveType public: using Base::Base; - static bool kindof(unsigned kind) { - return kind == Type::Kind::FIRST_PRIVATE_EXPERIMENTAL_9_TYPE + 1; - } - static TestRecursiveType create(MLIRContext *ctx, StringRef name) { return Base::get(ctx, Type::Kind::FIRST_PRIVATE_EXPERIMENTAL_9_TYPE + 1, name); From fff39b62bb4078ce78813f25c04e0da435a8feb3 Mon Sep 17 00:00:00 2001 From: River Riddle Date: Fri, 7 Aug 2020 13:30:29 -0700 Subject: [PATCH 13/26] [mlir][Attribute] Remove usages of Attribute::getKind This is in preparation for removing the use of "kinds" within attributes and types in MLIR. Differential Revision: https://reviews.llvm.org/D85370 --- mlir/include/mlir/IR/Attributes.h | 41 +-- mlir/include/mlir/IR/Location.h | 5 +- mlir/lib/Dialect/SPIRV/SPIRVOps.cpp | 41 +-- mlir/lib/IR/AsmPrinter.cpp | 280 ++++++++---------- mlir/lib/IR/Attributes.cpp | 44 +-- mlir/lib/IR/Diagnostics.cpp | 27 +- mlir/lib/IR/Location.cpp | 10 + mlir/lib/Target/LLVMIR/DebugTranslation.cpp | 30 +- .../Dialect/Quant/QuantizationUtilsTest.cpp | 2 +- 9 files changed, 211 insertions(+), 269 deletions(-) diff --git a/mlir/include/mlir/IR/Attributes.h b/mlir/include/mlir/IR/Attributes.h index a57adb315bc3af..75ac2adc302c1b 100644 --- a/mlir/include/mlir/IR/Attributes.h +++ b/mlir/include/mlir/IR/Attributes.h @@ -661,10 +661,7 @@ class ElementsAttr : public Attribute { function_ref mapping) const; /// Method for support type inquiry through isa, cast and dyn_cast. - static bool classof(Attribute attr) { - return attr.getKind() >= StandardAttributes::FIRST_ELEMENTS_ATTR && - attr.getKind() <= StandardAttributes::LAST_ELEMENTS_ATTR; - } + static bool classof(Attribute attr); protected: /// Returns the 1 dimensional flattened row-major index from the given @@ -729,10 +726,7 @@ class DenseElementsAttr : public ElementsAttr { using ElementsAttr::ElementsAttr; /// Method for support type inquiry through isa, cast and dyn_cast. - static bool classof(Attribute attr) { - return attr.getKind() == StandardAttributes::DenseIntOrFPElements || - attr.getKind() == StandardAttributes::DenseStringElements; - } + static bool classof(Attribute attr); /// Constructs a dense elements attribute from an array of element values. /// Each element attribute value is expected to be an element of 'type'. @@ -1513,12 +1507,10 @@ class ElementsAttrIterator template class ProcessFn, typename... Args> RetT process(Args &... args) const { - switch (attrKind) { - case StandardAttributes::DenseIntOrFPElements: + if (attr.isa()) return ProcessFn()(args...); - case StandardAttributes::SparseElements: + if (attr.isa()) return ProcessFn()(args...); - } llvm_unreachable("unexpected attribute kind"); } @@ -1543,22 +1535,21 @@ class ElementsAttrIterator }; public: - ElementsAttrIterator(const ElementsAttrIterator &rhs) - : attrKind(rhs.attrKind) { + ElementsAttrIterator(const ElementsAttrIterator &rhs) : attr(rhs.attr) { process(it, rhs.it); } ~ElementsAttrIterator() { process(it); } /// Methods necessary to support random access iteration. ptrdiff_t operator-(const ElementsAttrIterator &rhs) const { - assert(attrKind == rhs.attrKind && "incompatible iterators"); + assert(attr == rhs.attr && "incompatible iterators"); return process(it, rhs.it); } bool operator==(const ElementsAttrIterator &rhs) const { - return rhs.attrKind == attrKind && process(it, rhs.it); + return rhs.attr == attr && process(it, rhs.it); } bool operator<(const ElementsAttrIterator &rhs) const { - assert(attrKind == rhs.attrKind && "incompatible iterators"); + assert(attr == rhs.attr && "incompatible iterators"); return process(it, rhs.it); } ElementsAttrIterator &operator+=(ptrdiff_t offset) { @@ -1575,14 +1566,14 @@ class ElementsAttrIterator private: template - ElementsAttrIterator(unsigned attrKind, IteratorT &&it) - : attrKind(attrKind), it(std::forward(it)) {} + ElementsAttrIterator(Attribute attr, IteratorT &&it) + : attr(attr), it(std::forward(it)) {} /// Allow accessing the constructor. friend ElementsAttr; - /// The kind of derived elements attribute. - unsigned attrKind; + /// The parent elements attribute. + Attribute attr; /// A union containing the specific iterators for each derived kind. Iterator it; @@ -1599,13 +1590,13 @@ template auto ElementsAttr::getValues() const -> iterator_range { if (DenseElementsAttr denseAttr = dyn_cast()) { auto values = denseAttr.getValues(); - return {iterator(getKind(), values.begin()), - iterator(getKind(), values.end())}; + return {iterator(*this, values.begin()), + iterator(*this, values.end())}; } if (SparseElementsAttr sparseAttr = dyn_cast()) { auto values = sparseAttr.getValues(); - return {iterator(getKind(), values.begin()), - iterator(getKind(), values.end())}; + return {iterator(*this, values.begin()), + iterator(*this, values.end())}; } llvm_unreachable("unexpected attribute kind"); } diff --git a/mlir/include/mlir/IR/Location.h b/mlir/include/mlir/IR/Location.h index 5bbf003a427110..aed0c4239fb41c 100644 --- a/mlir/include/mlir/IR/Location.h +++ b/mlir/include/mlir/IR/Location.h @@ -42,10 +42,7 @@ class LocationAttr : public Attribute { using Attribute::Attribute; /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool classof(Attribute attr) { - return attr.getKind() >= StandardAttributes::FIRST_LOCATION_ATTR && - attr.getKind() <= StandardAttributes::LAST_LOCATION_ATTR; - } + static bool classof(Attribute attr); }; /// This class defines the main interface for locations in MLIR and acts as a diff --git a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp index b7d36f4a94875b..5e098e815d9871 100644 --- a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp +++ b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp @@ -1472,18 +1472,15 @@ static LogicalResult verify(spirv::ConstantOp constOp) { // ODS already generates checks to make sure the result type is valid. We just // need to additionally check that the value's attribute type is consistent // with the result type. - switch (value.getKind()) { - case StandardAttributes::Integer: - case StandardAttributes::Float: { + if (value.isa()) { if (valueType != opType) return constOp.emitOpError("result type (") << opType << ") does not match value type (" << valueType << ")"; return success(); - } break; - case StandardAttributes::DenseIntOrFPElements: - case StandardAttributes::SparseElements: { + } + if (value.isa()) { if (valueType == opType) - break; + return success(); auto arrayType = opType.dyn_cast(); auto shapedType = valueType.dyn_cast(); if (!arrayType) { @@ -1497,9 +1494,8 @@ static LogicalResult verify(spirv::ConstantOp constOp) { numElements *= t.getNumElements(); opElemType = t.getElementType(); } - if (!opElemType.isIntOrFloat()) { + if (!opElemType.isIntOrFloat()) return constOp.emitOpError("only support nested array result type"); - } auto valueElemType = shapedType.getElementType(); if (valueElemType != opElemType) { @@ -1513,26 +1509,24 @@ static LogicalResult verify(spirv::ConstantOp constOp) { << numElements << ") does not match value number of elements (" << shapedType.getNumElements() << ")"; } - } break; - case StandardAttributes::Array: { + return success(); + } + if (auto attayAttr = value.dyn_cast()) { auto arrayType = opType.dyn_cast(); if (!arrayType) return constOp.emitOpError( "must have spv.array result type for array value"); - auto elemType = arrayType.getElementType(); - for (auto element : value.cast().getValue()) { + Type elemType = arrayType.getElementType(); + for (Attribute element : attayAttr.getValue()) { if (element.getType() != elemType) return constOp.emitOpError("has array element whose type (") << element.getType() << ") does not match the result element type (" << elemType << ')'; } - } break; - default: - return constOp.emitOpError("cannot have value of type ") << valueType; + return success(); } - - return success(); + return constOp.emitOpError("cannot have value of type ") << valueType; } bool spirv::ConstantOp::isBuildableWith(Type type) { @@ -2619,19 +2613,14 @@ static LogicalResult verify(spirv::SpecConstantOp constOp) { return constOp.emitOpError("SpecId cannot be negative"); auto value = constOp.default_value(); - - switch (value.getKind()) { - case StandardAttributes::Integer: - case StandardAttributes::Float: { + if (value.isa()) { // Make sure bitwidth is allowed. if (!value.getType().isa()) return constOp.emitOpError("default value bitwidth disallowed"); return success(); } - default: - return constOp.emitOpError( - "default value can only be a bool, integer, or float scalar"); - } + return constOp.emitOpError( + "default value can only be a bool, integer, or float scalar"); } //===----------------------------------------------------------------------===// diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp index 372e4c93dc378e..4470f5b4b8264b 100644 --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -33,6 +33,7 @@ #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSet.h" +#include "llvm/ADT/TypeSwitch.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Regex.h" #include "llvm/Support/SaveAndRestore.h" @@ -1019,76 +1020,67 @@ void ModulePrinter::printTrailingLocation(Location loc) { } void ModulePrinter::printLocationInternal(LocationAttr loc, bool pretty) { - switch (loc.getKind()) { - case StandardAttributes::OpaqueLocation: - printLocationInternal(loc.cast().getFallbackLocation(), pretty); - break; - case StandardAttributes::UnknownLocation: - if (pretty) - os << "[unknown]"; - else - os << "unknown"; - break; - case StandardAttributes::FileLineColLocation: { - auto fileLoc = loc.cast(); - auto mayQuote = pretty ? "" : "\""; - os << mayQuote << fileLoc.getFilename() << mayQuote << ':' - << fileLoc.getLine() << ':' << fileLoc.getColumn(); - break; - } - case StandardAttributes::NameLocation: { - auto nameLoc = loc.cast(); - os << '\"' << nameLoc.getName() << '\"'; - - // Print the child if it isn't unknown. - auto childLoc = nameLoc.getChildLoc(); - if (!childLoc.isa()) { - os << '('; - printLocationInternal(childLoc, pretty); - os << ')'; - } - break; - } - case StandardAttributes::CallSiteLocation: { - auto callLocation = loc.cast(); - auto caller = callLocation.getCaller(); - auto callee = callLocation.getCallee(); - if (!pretty) - os << "callsite("; - printLocationInternal(callee, pretty); - if (pretty) { - if (callee.isa()) { - if (caller.isa()) { - os << " at "; + TypeSwitch(loc) + .Case([&](OpaqueLoc loc) { + printLocationInternal(loc.getFallbackLocation(), pretty); + }) + .Case([&](UnknownLoc loc) { + if (pretty) + os << "[unknown]"; + else + os << "unknown"; + }) + .Case([&](FileLineColLoc loc) { + StringRef mayQuote = pretty ? "" : "\""; + os << mayQuote << loc.getFilename() << mayQuote << ':' << loc.getLine() + << ':' << loc.getColumn(); + }) + .Case([&](NameLoc loc) { + os << '\"' << loc.getName() << '\"'; + + // Print the child if it isn't unknown. + auto childLoc = loc.getChildLoc(); + if (!childLoc.isa()) { + os << '('; + printLocationInternal(childLoc, pretty); + os << ')'; + } + }) + .Case([&](CallSiteLoc loc) { + Location caller = loc.getCaller(); + Location callee = loc.getCallee(); + if (!pretty) + os << "callsite("; + printLocationInternal(callee, pretty); + if (pretty) { + if (callee.isa()) { + if (caller.isa()) { + os << " at "; + } else { + os << newLine << " at "; + } + } else { + os << newLine << " at "; + } } else { - os << newLine << " at "; + os << " at "; } - } else { - os << newLine << " at "; - } - } else { - os << " at "; - } - printLocationInternal(caller, pretty); - if (!pretty) - os << ")"; - break; - } - case StandardAttributes::FusedLocation: { - auto fusedLoc = loc.cast(); - if (!pretty) - os << "fused"; - if (auto metadata = fusedLoc.getMetadata()) - os << '<' << metadata << '>'; - os << '['; - interleave( - fusedLoc.getLocations(), - [&](Location loc) { printLocationInternal(loc, pretty); }, - [&]() { os << ", "; }); - os << ']'; - break; - } - } + printLocationInternal(caller, pretty); + if (!pretty) + os << ")"; + }) + .Case([&](FusedLoc loc) { + if (!pretty) + os << "fused"; + if (Attribute metadata = loc.getMetadata()) + os << '<' << metadata << '>'; + os << '['; + interleave( + loc.getLocations(), + [&](Location loc) { printLocationInternal(loc, pretty); }, + [&]() { os << ", "; }); + os << ']'; + }); } /// Print a floating point value in a way that the parser will be able to @@ -1305,27 +1297,19 @@ void ModulePrinter::printAttribute(Attribute attr, } auto attrType = attr.getType(); - switch (attr.getKind()) { - default: - return printDialectAttribute(attr); - - case StandardAttributes::Opaque: { - auto opaqueAttr = attr.cast(); + if (auto opaqueAttr = attr.dyn_cast()) { printDialectSymbol(os, "#", opaqueAttr.getDialectNamespace(), opaqueAttr.getAttrData()); - break; - } - case StandardAttributes::Unit: + } else if (attr.isa()) { os << "unit"; - break; - case StandardAttributes::Dictionary: + return; + } else if (auto dictAttr = attr.dyn_cast()) { os << '{'; - interleaveComma(attr.cast().getValue(), + interleaveComma(dictAttr.getValue(), [&](NamedAttribute attr) { printNamedAttribute(attr); }); os << '}'; - break; - case StandardAttributes::Integer: { - auto intAttr = attr.cast(); + + } else if (auto intAttr = attr.dyn_cast()) { if (attrType.isSignlessInteger(1)) { os << (intAttr.getValue().getBoolValue() ? "true" : "false"); @@ -1343,114 +1327,98 @@ void ModulePrinter::printAttribute(Attribute attr, // IntegerAttr elides the type if I64. if (typeElision == AttrTypeElision::May && attrType.isSignlessInteger(64)) return; - break; - } - case StandardAttributes::Float: { - auto floatAttr = attr.cast(); + + } else if (auto floatAttr = attr.dyn_cast()) { printFloatValue(floatAttr.getValue(), os); // FloatAttr elides the type if F64. if (typeElision == AttrTypeElision::May && attrType.isF64()) return; - break; - } - case StandardAttributes::String: + + } else if (auto strAttr = attr.dyn_cast()) { os << '"'; - printEscapedString(attr.cast().getValue(), os); + printEscapedString(strAttr.getValue(), os); os << '"'; - break; - case StandardAttributes::Array: + + } else if (auto arrayAttr = attr.dyn_cast()) { os << '['; - interleaveComma(attr.cast().getValue(), [&](Attribute attr) { + interleaveComma(arrayAttr.getValue(), [&](Attribute attr) { printAttribute(attr, AttrTypeElision::May); }); os << ']'; - break; - case StandardAttributes::AffineMap: + + } else if (auto affineMapAttr = attr.dyn_cast()) { os << "affine_map<"; - attr.cast().getValue().print(os); + affineMapAttr.getValue().print(os); os << '>'; // AffineMap always elides the type. return; - case StandardAttributes::IntegerSet: + + } else if (auto integerSetAttr = attr.dyn_cast()) { os << "affine_set<"; - attr.cast().getValue().print(os); + integerSetAttr.getValue().print(os); os << '>'; // IntegerSet always elides the type. return; - case StandardAttributes::Type: - printType(attr.cast().getValue()); - break; - case StandardAttributes::SymbolRef: { - auto refAttr = attr.dyn_cast(); + + } else if (auto typeAttr = attr.dyn_cast()) { + printType(typeAttr.getValue()); + + } else if (auto refAttr = attr.dyn_cast()) { printSymbolReference(refAttr.getRootReference(), os); for (FlatSymbolRefAttr nestedRef : refAttr.getNestedReferences()) { os << "::"; printSymbolReference(nestedRef.getValue(), os); } - break; - } - case StandardAttributes::OpaqueElements: { - auto eltsAttr = attr.cast(); - if (printerFlags.shouldElideElementsAttr(eltsAttr)) { + + } else if (auto opaqueAttr = attr.dyn_cast()) { + if (printerFlags.shouldElideElementsAttr(opaqueAttr)) { printElidedElementsAttr(os); - break; + } else { + os << "opaque<\"" << opaqueAttr.getDialect()->getNamespace() << "\", "; + os << '"' << "0x" << llvm::toHex(opaqueAttr.getValue()) << "\">"; } - os << "opaque<\"" << eltsAttr.getDialect()->getNamespace() << "\", "; - os << '"' << "0x" << llvm::toHex(eltsAttr.getValue()) << "\">"; - break; - } - case StandardAttributes::DenseIntOrFPElements: { - auto eltsAttr = attr.cast(); - if (printerFlags.shouldElideElementsAttr(eltsAttr)) { + + } else if (auto intOrFpEltAttr = attr.dyn_cast()) { + if (printerFlags.shouldElideElementsAttr(intOrFpEltAttr)) { printElidedElementsAttr(os); - break; + } else { + os << "dense<"; + printDenseIntOrFPElementsAttr(intOrFpEltAttr, /*allowHex=*/true); + os << '>'; } - os << "dense<"; - printDenseIntOrFPElementsAttr(eltsAttr, /*allowHex=*/true); - os << '>'; - break; - } - case StandardAttributes::DenseStringElements: { - auto eltsAttr = attr.cast(); - if (printerFlags.shouldElideElementsAttr(eltsAttr)) { + + } else if (auto strEltAttr = attr.dyn_cast()) { + if (printerFlags.shouldElideElementsAttr(strEltAttr)) { printElidedElementsAttr(os); - break; + } else { + os << "dense<"; + printDenseStringElementsAttr(strEltAttr); + os << '>'; } - os << "dense<"; - printDenseStringElementsAttr(eltsAttr); - os << '>'; - break; - } - case StandardAttributes::SparseElements: { - auto elementsAttr = attr.cast(); - if (printerFlags.shouldElideElementsAttr(elementsAttr.getIndices()) || - printerFlags.shouldElideElementsAttr(elementsAttr.getValues())) { + + } else if (auto sparseEltAttr = attr.dyn_cast()) { + if (printerFlags.shouldElideElementsAttr(sparseEltAttr.getIndices()) || + printerFlags.shouldElideElementsAttr(sparseEltAttr.getValues())) { printElidedElementsAttr(os); - break; - } - os << "sparse<"; - DenseIntElementsAttr indices = elementsAttr.getIndices(); - if (indices.getNumElements() != 0) { - printDenseIntOrFPElementsAttr(indices, /*allowHex=*/false); - os << ", "; - printDenseElementsAttr(elementsAttr.getValues(), /*allowHex=*/true); + } else { + os << "sparse<"; + DenseIntElementsAttr indices = sparseEltAttr.getIndices(); + if (indices.getNumElements() != 0) { + printDenseIntOrFPElementsAttr(indices, /*allowHex=*/false); + os << ", "; + printDenseElementsAttr(sparseEltAttr.getValues(), /*allowHex=*/true); + } + os << '>'; } - os << '>'; - break; - } - // Location attributes. - case StandardAttributes::CallSiteLocation: - case StandardAttributes::FileLineColLocation: - case StandardAttributes::FusedLocation: - case StandardAttributes::NameLocation: - case StandardAttributes::OpaqueLocation: - case StandardAttributes::UnknownLocation: - printLocation(attr.cast()); - break; + } else if (auto locAttr = attr.dyn_cast()) { + printLocation(locAttr); + + } else { + return printDialectAttribute(attr); } // Don't print the type if we must elide it, or if it is a None type. diff --git a/mlir/lib/IR/Attributes.cpp b/mlir/lib/IR/Attributes.cpp index 8202465af0c768..e353b0b90a2a8f 100644 --- a/mlir/lib/IR/Attributes.cpp +++ b/mlir/lib/IR/Attributes.cpp @@ -460,16 +460,11 @@ int64_t ElementsAttr::getNumElements() const { /// Return the value at the given index. If index does not refer to a valid /// element, then a null attribute is returned. Attribute ElementsAttr::getValue(ArrayRef index) const { - switch (getKind()) { - case StandardAttributes::DenseIntOrFPElements: - return cast().getValue(index); - case StandardAttributes::OpaqueElements: - return cast().getValue(index); - case StandardAttributes::SparseElements: - return cast().getValue(index); - default: - llvm_unreachable("unknown ElementsAttr kind"); - } + if (auto denseAttr = dyn_cast()) + return denseAttr.getValue(index); + if (auto opaqueAttr = dyn_cast()) + return opaqueAttr.getValue(index); + return cast().getValue(index); } /// Return if the given 'index' refers to a valid element in this attribute. @@ -491,23 +486,23 @@ bool ElementsAttr::isValidIndex(ArrayRef index) const { ElementsAttr ElementsAttr::mapValues(Type newElementType, function_ref mapping) const { - switch (getKind()) { - case StandardAttributes::DenseIntOrFPElements: - return cast().mapValues(newElementType, mapping); - default: - llvm_unreachable("unsupported ElementsAttr subtype"); - } + if (auto intOrFpAttr = dyn_cast()) + return intOrFpAttr.mapValues(newElementType, mapping); + llvm_unreachable("unsupported ElementsAttr subtype"); } ElementsAttr ElementsAttr::mapValues(Type newElementType, function_ref mapping) const { - switch (getKind()) { - case StandardAttributes::DenseIntOrFPElements: - return cast().mapValues(newElementType, mapping); - default: - llvm_unreachable("unsupported ElementsAttr subtype"); - } + if (auto intOrFpAttr = dyn_cast()) + return intOrFpAttr.mapValues(newElementType, mapping); + llvm_unreachable("unsupported ElementsAttr subtype"); +} + +/// Method for support type inquiry through isa, cast and dyn_cast. +bool ElementsAttr::classof(Attribute attr) { + return attr.isa(); } /// Returns the 1 dimensional flattened row-major index from the given @@ -718,6 +713,11 @@ DenseElementsAttr::ComplexFloatElementIterator::ComplexFloatElementIterator( // DenseElementsAttr //===----------------------------------------------------------------------===// +/// Method for support type inquiry through isa, cast and dyn_cast. +bool DenseElementsAttr::classof(Attribute attr) { + return attr.isa(); +} + DenseElementsAttr DenseElementsAttr::get(ShapedType type, ArrayRef values) { assert(hasSameElementsOrSplat(type, values)); diff --git a/mlir/lib/IR/Diagnostics.cpp b/mlir/lib/IR/Diagnostics.cpp index 34908c61639f3e..15dbac1f6cb870 100644 --- a/mlir/lib/IR/Diagnostics.cpp +++ b/mlir/lib/IR/Diagnostics.cpp @@ -366,43 +366,38 @@ struct SourceMgrDiagnosticHandlerImpl { /// Return a processable FileLineColLoc from the given location. static Optional getFileLineColLoc(Location loc) { - switch (loc->getKind()) { - case StandardAttributes::NameLocation: + if (auto nameLoc = loc.dyn_cast()) return getFileLineColLoc(loc.cast().getChildLoc()); - case StandardAttributes::FileLineColLocation: - return loc.cast(); - case StandardAttributes::CallSiteLocation: - // Process the callee of a callsite location. + if (auto fileLoc = loc.dyn_cast()) + return fileLoc; + if (auto callLoc = loc.dyn_cast()) return getFileLineColLoc(loc.cast().getCallee()); - case StandardAttributes::FusedLocation: + if (auto fusedLoc = loc.dyn_cast()) { for (auto subLoc : loc.cast().getLocations()) { if (auto callLoc = getFileLineColLoc(subLoc)) { return callLoc; } } return llvm::None; - default: - return llvm::None; } + return llvm::None; } /// Return a processable CallSiteLoc from the given location. static Optional getCallSiteLoc(Location loc) { - switch (loc->getKind()) { - case StandardAttributes::NameLocation: + if (auto nameLoc = loc.dyn_cast()) return getCallSiteLoc(loc.cast().getChildLoc()); - case StandardAttributes::CallSiteLocation: - return loc.cast(); - case StandardAttributes::FusedLocation: + if (auto callLoc = loc.dyn_cast()) + return callLoc; + if (auto fusedLoc = loc.dyn_cast()) { for (auto subLoc : loc.cast().getLocations()) { if (auto callLoc = getCallSiteLoc(subLoc)) { return callLoc; } } return llvm::None; - default: - return llvm::None; } + return llvm::None; } /// Given a diagnostic kind, returns the LLVM DiagKind. diff --git a/mlir/lib/IR/Location.cpp b/mlir/lib/IR/Location.cpp index f22fd5cb785292..48b05ba0eb40da 100644 --- a/mlir/lib/IR/Location.cpp +++ b/mlir/lib/IR/Location.cpp @@ -13,6 +13,16 @@ using namespace mlir; using namespace mlir::detail; +//===----------------------------------------------------------------------===// +// LocationAttr +//===----------------------------------------------------------------------===// + +/// Methods for support type inquiry through isa, cast, and dyn_cast. +bool LocationAttr::classof(Attribute attr) { + return attr.isa(); +} + //===----------------------------------------------------------------------===// // CallSiteLoc //===----------------------------------------------------------------------===// diff --git a/mlir/lib/Target/LLVMIR/DebugTranslation.cpp b/mlir/lib/Target/LLVMIR/DebugTranslation.cpp index f40f44f2fbc6d6..af364ba9048fb2 100644 --- a/mlir/lib/Target/LLVMIR/DebugTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/DebugTranslation.cpp @@ -115,26 +115,19 @@ DebugTranslation::translateLoc(Location loc, llvm::DILocalScope *scope, return existingIt->second; const llvm::DILocation *llvmLoc = nullptr; - switch (loc->getKind()) { - case StandardAttributes::CallSiteLocation: { - auto callLoc = loc.dyn_cast(); - + if (auto callLoc = loc.dyn_cast()) { // For callsites, the caller is fed as the inlinedAt for the callee. const auto *callerLoc = translateLoc(callLoc.getCaller(), scope, inlinedAt); llvmLoc = translateLoc(callLoc.getCallee(), scope, callerLoc); - break; - } - case StandardAttributes::FileLineColLocation: { - auto fileLoc = loc.dyn_cast(); + + } else if (auto fileLoc = loc.dyn_cast()) { auto *file = translateFile(fileLoc.getFilename()); auto *fileScope = builder.createLexicalBlockFile(scope, file); llvmLoc = llvm::DILocation::get(llvmCtx, fileLoc.getLine(), fileLoc.getColumn(), fileScope, const_cast(inlinedAt)); - break; - } - case StandardAttributes::FusedLocation: { - auto fusedLoc = loc.dyn_cast(); + + } else if (auto fusedLoc = loc.dyn_cast()) { ArrayRef locations = fusedLoc.getLocations(); // For fused locations, merge each of the nodes. @@ -143,18 +136,17 @@ DebugTranslation::translateLoc(Location loc, llvm::DILocalScope *scope, llvmLoc = llvm::DILocation::getMergedLocation( llvmLoc, translateLoc(locIt, scope, inlinedAt)); } - break; - } - case StandardAttributes::NameLocation: + + } else if (auto nameLoc = loc.dyn_cast()) { llvmLoc = translateLoc(loc.cast().getChildLoc(), scope, inlinedAt); - break; - case StandardAttributes::OpaqueLocation: + + } else if (auto opaqueLoc = loc.dyn_cast()) { llvmLoc = translateLoc(loc.cast().getFallbackLocation(), scope, inlinedAt); - break; - default: + } else { llvm_unreachable("unknown location kind"); } + locationToLoc.try_emplace(std::make_pair(loc, scope), llvmLoc); return llvmLoc; } diff --git a/mlir/unittests/Dialect/Quant/QuantizationUtilsTest.cpp b/mlir/unittests/Dialect/Quant/QuantizationUtilsTest.cpp index 68e43d45ab4278..97c94a54ffc478 100644 --- a/mlir/unittests/Dialect/Quant/QuantizationUtilsTest.cpp +++ b/mlir/unittests/Dialect/Quant/QuantizationUtilsTest.cpp @@ -158,7 +158,7 @@ TEST(QuantizationUtilsTest, convertRankedSparseAttrUniform) { auto expectedTensorType = realValue.getType().cast(); EXPECT_EQ(tensorType.getShape(), expectedTensorType.getShape()); EXPECT_EQ(tensorType.getElementType(), convertedType); - EXPECT_EQ(returnedValue.getKind(), StandardAttributes::SparseElements); + EXPECT_TRUE(returnedValue.isa()); // Check Elements attribute element value is expected. auto firstValue = returnedValue.cast().getValue({0, 0}); From c8c45985fba935f28943d6218915d7fe5a5fc807 Mon Sep 17 00:00:00 2001 From: River Riddle Date: Fri, 7 Aug 2020 13:30:43 -0700 Subject: [PATCH 14/26] [mlir][Type] Remove usages of Type::getKind This is in preparation for removing the use of "kinds" within attributes and types in MLIR. Differential Revision: https://reviews.llvm.org/D85475 --- mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h | 5 +- mlir/include/mlir/Dialect/Quant/QuantTypes.h | 5 +- mlir/include/mlir/IR/StandardTypes.h | 44 ++++++++------- mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp | 4 ++ mlir/lib/Dialect/Linalg/IR/LinalgTypes.cpp | 8 +-- mlir/lib/Dialect/Quant/IR/QuantTypes.cpp | 5 ++ mlir/lib/Dialect/Quant/IR/TypeParser.cpp | 20 +++---- .../Dialect/Quant/Utils/UniformSupport.cpp | 53 +++++++------------ mlir/lib/Dialect/SPIRV/LayoutUtils.cpp | 21 ++++---- mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp | 31 +++-------- mlir/lib/Dialect/SPIRV/SPIRVOps.cpp | 3 +- mlir/lib/Dialect/SPIRV/SPIRVTypes.cpp | 42 +++++---------- mlir/lib/Dialect/Traits.cpp | 14 ++--- mlir/lib/IR/StandardTypes.cpp | 30 ++++++----- 14 files changed, 114 insertions(+), 171 deletions(-) diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h b/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h index 32ec77ad63e4f1..449ade85a5b43b 100644 --- a/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h +++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h @@ -101,10 +101,7 @@ class LLVMType : public Type { } /// Support for isa/cast. - static bool classof(Type type) { - return type.getKind() >= FIRST_NEW_LLVM_TYPE && - type.getKind() <= LAST_NEW_LLVM_TYPE; - } + static bool classof(Type type); LLVMDialect &getDialect(); diff --git a/mlir/include/mlir/Dialect/Quant/QuantTypes.h b/mlir/include/mlir/Dialect/Quant/QuantTypes.h index 689ac49163ebea..ccdc289a9a7c7b 100644 --- a/mlir/include/mlir/Dialect/Quant/QuantTypes.h +++ b/mlir/include/mlir/Dialect/Quant/QuantTypes.h @@ -71,10 +71,7 @@ class QuantizedType : public Type { int64_t storageTypeMax); /// Support method to enable LLVM-style type casting. - static bool classof(Type type) { - return type.getKind() >= Type::FIRST_QUANTIZATION_TYPE && - type.getKind() <= QuantizationTypes::LAST_USED_QUANTIZATION_TYPE; - } + static bool classof(Type type); /// Gets the minimum possible stored by a storageType. storageTypeMin must /// be greater than or equal to this value. diff --git a/mlir/include/mlir/IR/StandardTypes.h b/mlir/include/mlir/IR/StandardTypes.h index ff9af5bcdeeb68..11f7e442f4164d 100644 --- a/mlir/include/mlir/IR/StandardTypes.h +++ b/mlir/include/mlir/IR/StandardTypes.h @@ -294,13 +294,7 @@ class ShapedType : public Type { int64_t getSizeInBits() const; /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool classof(Type type) { - return type.getKind() == StandardTypes::Vector || - type.getKind() == StandardTypes::RankedTensor || - type.getKind() == StandardTypes::UnrankedTensor || - type.getKind() == StandardTypes::UnrankedMemRef || - type.getKind() == StandardTypes::MemRef; - } + static bool classof(Type type); /// Whether the given dimension size indicates a dynamic dimension. static constexpr bool isDynamic(int64_t dSize) { @@ -358,20 +352,10 @@ class TensorType : public ShapedType { using ShapedType::ShapedType; /// Return true if the specified element type is ok in a tensor. - static bool isValidElementType(Type type) { - // Note: Non standard/builtin types are allowed to exist within tensor - // types. Dialects are expected to verify that tensor types have a valid - // element type within that dialect. - return type.isa() || - (type.getKind() > Type::Kind::LAST_STANDARD_TYPE); - } + static bool isValidElementType(Type type); /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool classof(Type type) { - return type.getKind() == StandardTypes::RankedTensor || - type.getKind() == StandardTypes::UnrankedTensor; - } + static bool classof(Type type); }; //===----------------------------------------------------------------------===// @@ -443,10 +427,7 @@ class BaseMemRefType : public ShapedType { using ShapedType::ShapedType; /// Methods for support type inquiry through isa, cast, and dyn_cast. - static bool classof(Type type) { - return type.getKind() == StandardTypes::MemRef || - type.getKind() == StandardTypes::UnrankedMemRef; - } + static bool classof(Type type); }; //===----------------------------------------------------------------------===// @@ -629,6 +610,23 @@ class TupleType } }; +//===----------------------------------------------------------------------===// +// Deferred Method Definitions +//===----------------------------------------------------------------------===// + +inline bool BaseMemRefType::classof(Type type) { + return type.isa(); +} + +inline bool ShapedType::classof(Type type) { + return type.isa(); +} + +inline bool TensorType::classof(Type type) { + return type.isa(); +} + //===----------------------------------------------------------------------===// // Type Utilities //===----------------------------------------------------------------------===// diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp index ee429c1f73e3f2..7d052e3d644e92 100644 --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp @@ -27,6 +27,10 @@ using namespace mlir::LLVM; // LLVMType. //===----------------------------------------------------------------------===// +bool LLVMType::classof(Type type) { + return llvm::isa(type.getDialect()); +} + LLVMDialect &LLVMType::getDialect() { return static_cast(Type::getDialect()); } diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgTypes.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgTypes.cpp index 50924f7b786637..b8bffd35f5a12d 100644 --- a/mlir/lib/Dialect/Linalg/IR/LinalgTypes.cpp +++ b/mlir/lib/Dialect/Linalg/IR/LinalgTypes.cpp @@ -55,11 +55,5 @@ static void print(RangeType rt, DialectAsmPrinter &os) { os << "range"; } void mlir::linalg::LinalgDialect::printType(Type type, DialectAsmPrinter &os) const { - switch (type.getKind()) { - default: - llvm_unreachable("Unhandled Linalg type"); - case LinalgTypes::Range: - print(type.cast(), os); - break; - } + print(type.cast(), os); } diff --git a/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp b/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp index 7ef5b4a77c549f..ef7d8144b25995 100644 --- a/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp +++ b/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp @@ -8,6 +8,7 @@ #include "mlir/Dialect/Quant/QuantTypes.h" #include "TypeDetail.h" +#include "mlir/Dialect/Quant/QuantOps.h" #include "mlir/IR/MLIRContext.h" #include "mlir/IR/StandardTypes.h" @@ -23,6 +24,10 @@ unsigned QuantizedType::getFlags() const { return static_cast(impl)->flags; } +bool QuantizedType::classof(Type type) { + return llvm::isa(type.getDialect()); +} + LogicalResult QuantizedType::verifyConstructionInvariants( Location loc, unsigned flags, Type storageType, Type expressedType, int64_t storageTypeMin, int64_t storageTypeMax) { diff --git a/mlir/lib/Dialect/Quant/IR/TypeParser.cpp b/mlir/lib/Dialect/Quant/IR/TypeParser.cpp index 60b3b15d02af96..c3fc3e5775c66c 100644 --- a/mlir/lib/Dialect/Quant/IR/TypeParser.cpp +++ b/mlir/lib/Dialect/Quant/IR/TypeParser.cpp @@ -365,18 +365,12 @@ static void printUniformQuantizedPerAxisType(UniformQuantizedPerAxisType type, /// Print a type registered to this dialect. void QuantizationDialect::printType(Type type, DialectAsmPrinter &os) const { - switch (type.getKind()) { - default: + if (auto anyType = type.dyn_cast()) + printAnyQuantizedType(anyType, os); + else if (auto uniformType = type.dyn_cast()) + printUniformQuantizedType(uniformType, os); + else if (auto perAxisType = type.dyn_cast()) + printUniformQuantizedPerAxisType(perAxisType, os); + else llvm_unreachable("Unhandled quantized type"); - case QuantizationTypes::Any: - printAnyQuantizedType(type.cast(), os); - break; - case QuantizationTypes::UniformQuantized: - printUniformQuantizedType(type.cast(), os); - break; - case QuantizationTypes::UniformQuantizedPerAxis: - printUniformQuantizedPerAxisType(type.cast(), - os); - break; - } } diff --git a/mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp b/mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp index a79ef0023a7fa8..bde201e1ef1f73 100644 --- a/mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp +++ b/mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp @@ -19,48 +19,33 @@ static bool isQuantizablePrimitiveType(Type inputType) { const ExpressedToQuantizedConverter ExpressedToQuantizedConverter::forInputType(Type inputType) { - switch (inputType.getKind()) { - default: - if (isQuantizablePrimitiveType(inputType)) { - // Supported primitive type (which just is the expressed type). - return ExpressedToQuantizedConverter{inputType, inputType}; - } - // Unsupported. - return ExpressedToQuantizedConverter{inputType, nullptr}; - case StandardTypes::RankedTensor: - case StandardTypes::UnrankedTensor: - case StandardTypes::Vector: { + if (inputType.isa()) { Type elementType = inputType.cast().getElementType(); - if (!isQuantizablePrimitiveType(elementType)) { - // Unsupported. + if (!isQuantizablePrimitiveType(elementType)) return ExpressedToQuantizedConverter{inputType, nullptr}; - } - return ExpressedToQuantizedConverter{ - inputType, inputType.cast().getElementType()}; - } + return ExpressedToQuantizedConverter{inputType, elementType}; } + // Supported primitive type (which just is the expressed type). + if (isQuantizablePrimitiveType(inputType)) + return ExpressedToQuantizedConverter{inputType, inputType}; + // Unsupported. + return ExpressedToQuantizedConverter{inputType, nullptr}; } Type ExpressedToQuantizedConverter::convert(QuantizedType elementalType) const { assert(expressedType && "convert() on unsupported conversion"); - - switch (inputType.getKind()) { - default: - if (elementalType.getExpressedType() == expressedType) { - // If the expressed types match, just use the new elemental type. - return elementalType; - } - // Unsupported. - return nullptr; - case StandardTypes::RankedTensor: - return RankedTensorType::get(inputType.cast().getShape(), - elementalType); - case StandardTypes::UnrankedTensor: + if (auto tensorType = inputType.dyn_cast()) + return RankedTensorType::get(tensorType.getShape(), elementalType); + if (auto tensorType = inputType.dyn_cast()) return UnrankedTensorType::get(elementalType); - case StandardTypes::Vector: - return VectorType::get(inputType.cast().getShape(), - elementalType); - } + if (auto vectorType = inputType.dyn_cast()) + return VectorType::get(vectorType.getShape(), elementalType); + + // If the expressed types match, just use the new elemental type. + if (elementalType.getExpressedType() == expressedType) + return elementalType; + // Unsupported. + return nullptr; } ElementsAttr diff --git a/mlir/lib/Dialect/SPIRV/LayoutUtils.cpp b/mlir/lib/Dialect/SPIRV/LayoutUtils.cpp index e456f499b745c8..c303f38a8e0cf4 100644 --- a/mlir/lib/Dialect/SPIRV/LayoutUtils.cpp +++ b/mlir/lib/Dialect/SPIRV/LayoutUtils.cpp @@ -78,20 +78,17 @@ Type VulkanLayoutUtils::decorateType(Type type, VulkanLayoutUtils::Size &size, size = alignment; return type; } - - switch (type.getKind()) { - case spirv::TypeKind::Struct: - return decorateType(type.cast(), size, alignment); - case spirv::TypeKind::Array: - return decorateType(type.cast(), size, alignment); - case StandardTypes::Vector: - return decorateType(type.cast(), size, alignment); - case spirv::TypeKind::RuntimeArray: + if (auto structType = type.dyn_cast()) + return decorateType(structType, size, alignment); + if (auto arrayType = type.dyn_cast()) + return decorateType(arrayType, size, alignment); + if (auto vectorType = type.dyn_cast()) + return decorateType(vectorType, size, alignment); + if (auto arrayType = type.dyn_cast()) { size = std::numeric_limits().max(); - return decorateType(type.cast(), alignment); - default: - llvm_unreachable("unhandled SPIR-V type"); + return decorateType(arrayType, alignment); } + llvm_unreachable("unhandled SPIR-V type"); } Type VulkanLayoutUtils::decorateType(VectorType vectorType, diff --git a/mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp b/mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp index 01c305720571fc..47f4b4ecbe559d 100644 --- a/mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp +++ b/mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp @@ -26,6 +26,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringSwitch.h" +#include "llvm/ADT/TypeSwitch.h" #include "llvm/Support/raw_ostream.h" namespace mlir { @@ -727,31 +728,11 @@ static void print(MatrixType type, DialectAsmPrinter &os) { } void SPIRVDialect::printType(Type type, DialectAsmPrinter &os) const { - switch (type.getKind()) { - case TypeKind::Array: - print(type.cast(), os); - return; - case TypeKind::CooperativeMatrix: - print(type.cast(), os); - return; - case TypeKind::Pointer: - print(type.cast(), os); - return; - case TypeKind::RuntimeArray: - print(type.cast(), os); - return; - case TypeKind::Image: - print(type.cast(), os); - return; - case TypeKind::Struct: - print(type.cast(), os); - return; - case TypeKind::Matrix: - print(type.cast(), os); - return; - default: - llvm_unreachable("unhandled SPIR-V type"); - } + TypeSwitch(type) + .Case( + [&](auto type) { print(type, os); }) + .Default([](Type) { llvm_unreachable("unhandled SPIR-V type"); }); } //===----------------------------------------------------------------------===// diff --git a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp index 5e098e815d9871..06b06ddcc9130e 100644 --- a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp +++ b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp @@ -1534,8 +1534,7 @@ bool spirv::ConstantOp::isBuildableWith(Type type) { if (!type.isa()) return false; - if (type.getKind() >= Type::FIRST_SPIRV_TYPE && - type.getKind() <= spirv::TypeKind::LAST_SPIRV_TYPE) { + if (isa(type.getDialect())) { // TODO: support constant struct return type.isa(); } diff --git a/mlir/lib/Dialect/SPIRV/SPIRVTypes.cpp b/mlir/lib/Dialect/SPIRV/SPIRVTypes.cpp index be42ca833f2150..6144edef2966cc 100644 --- a/mlir/lib/Dialect/SPIRV/SPIRVTypes.cpp +++ b/mlir/lib/Dialect/SPIRV/SPIRVTypes.cpp @@ -18,6 +18,7 @@ #include "llvm/ADT/SetVector.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSwitch.h" +#include "llvm/ADT/TypeSwitch.h" using namespace mlir; using namespace mlir::spirv; @@ -163,18 +164,11 @@ Optional ArrayType::getSizeInBytes() { //===----------------------------------------------------------------------===// bool CompositeType::classof(Type type) { - switch (type.getKind()) { - case TypeKind::Array: - case TypeKind::CooperativeMatrix: - case TypeKind::Matrix: - case TypeKind::RuntimeArray: - case TypeKind::Struct: - return true; - case StandardTypes::Vector: - return isValid(type.cast()); - default: - return false; - } + if (auto vectorType = type.dyn_cast()) + return isValid(vectorType); + return type + .isa(); } bool CompositeType::isValid(VectorType type) { @@ -183,22 +177,14 @@ bool CompositeType::isValid(VectorType type) { } Type CompositeType::getElementType(unsigned index) const { - switch (getKind()) { - case spirv::TypeKind::Array: - return cast().getElementType(); - case spirv::TypeKind::CooperativeMatrix: - return cast().getElementType(); - case spirv::TypeKind::Matrix: - return cast().getColumnType(); - case spirv::TypeKind::RuntimeArray: - return cast().getElementType(); - case spirv::TypeKind::Struct: - return cast().getElementType(index); - case StandardTypes::Vector: - return cast().getElementType(); - default: - llvm_unreachable("invalid composite type"); - } + return TypeSwitch(*this) + .Case( + [](auto type) { return type.getElementType(); }) + .Case([](MatrixType type) { return type.getColumnType(); }) + .Case( + [index](StructType type) { return type.getElementType(index); }) + .Default( + [](Type) -> Type { llvm_unreachable("invalid composite type"); }); } unsigned CompositeType::getNumElements() const { diff --git a/mlir/lib/Dialect/Traits.cpp b/mlir/lib/Dialect/Traits.cpp index 2a557c489e0b7f..ca7a25dae03569 100644 --- a/mlir/lib/Dialect/Traits.cpp +++ b/mlir/lib/Dialect/Traits.cpp @@ -123,16 +123,16 @@ Type OpTrait::util::getBroadcastedType(Type type1, Type type2, // Returns the type kind if the given type is a vector or ranked tensor type. // Returns llvm::None otherwise. - auto getCompositeTypeKind = [](Type type) -> Optional { + auto getCompositeTypeKind = [](Type type) -> Optional { if (type.isa()) - return static_cast(type.getKind()); + return type.getTypeID(); return llvm::None; }; // Make sure the composite type, if has, is consistent. - auto compositeKind1 = getCompositeTypeKind(type1); - auto compositeKind2 = getCompositeTypeKind(type2); - Optional resultCompositeKind; + Optional compositeKind1 = getCompositeTypeKind(type1); + Optional compositeKind2 = getCompositeTypeKind(type2); + Optional resultCompositeKind; if (compositeKind1 && compositeKind2) { // Disallow mixing vector and tensor. @@ -151,9 +151,9 @@ Type OpTrait::util::getBroadcastedType(Type type1, Type type2, return {}; // Compose the final broadcasted type - if (resultCompositeKind == StandardTypes::Vector) + if (resultCompositeKind == VectorType::getTypeID()) return VectorType::get(resultShape, elementType); - if (resultCompositeKind == StandardTypes::RankedTensor) + if (resultCompositeKind == RankedTensorType::getTypeID()) return RankedTensorType::get(resultShape, elementType); return elementType; } diff --git a/mlir/lib/IR/StandardTypes.cpp b/mlir/lib/IR/StandardTypes.cpp index 0cc82477d380f3..fc4f555b37f1f8 100644 --- a/mlir/lib/IR/StandardTypes.cpp +++ b/mlir/lib/IR/StandardTypes.cpp @@ -11,6 +11,7 @@ #include "mlir/IR/AffineExpr.h" #include "mlir/IR/AffineMap.h" #include "mlir/IR/Diagnostics.h" +#include "mlir/IR/Dialect.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/Twine.h" @@ -244,16 +245,11 @@ int64_t ShapedType::getSizeInBits() const { } ArrayRef ShapedType::getShape() const { - switch (getKind()) { - case StandardTypes::Vector: - return cast().getShape(); - case StandardTypes::RankedTensor: - return cast().getShape(); - case StandardTypes::MemRef: - return cast().getShape(); - default: - llvm_unreachable("not a ShapedType or not ranked"); - } + if (auto vectorType = dyn_cast()) + return vectorType.getShape(); + if (auto tensorType = dyn_cast()) + return tensorType.getShape(); + return cast().getShape(); } int64_t ShapedType::getNumDynamicDims() const { @@ -305,13 +301,23 @@ ArrayRef VectorType::getShape() const { return getImpl()->getShape(); } // Check if "elementType" can be an element type of a tensor. Emit errors if // location is not nullptr. Returns failure if check failed. -static inline LogicalResult checkTensorElementType(Location location, - Type elementType) { +static LogicalResult checkTensorElementType(Location location, + Type elementType) { if (!TensorType::isValidElementType(elementType)) return emitError(location, "invalid tensor element type"); return success(); } +/// Return true if the specified element type is ok in a tensor. +bool TensorType::isValidElementType(Type type) { + // Note: Non standard/builtin types are allowed to exist within tensor + // types. Dialects are expected to verify that tensor types have a valid + // element type within that dialect. + return type.isa() || + !type.getDialect().getNamespace().empty(); +} + //===----------------------------------------------------------------------===// // RankedTensorType //===----------------------------------------------------------------------===// From 82fd1392016984c81c6037e147ee2dd36cf91f4c Mon Sep 17 00:00:00 2001 From: River Riddle Date: Fri, 7 Aug 2020 13:41:42 -0700 Subject: [PATCH 15/26] [flang] Update FirOpsDialect constructor to pass its TypeID --- flang/lib/Optimizer/Dialect/FIRDialect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flang/lib/Optimizer/Dialect/FIRDialect.cpp b/flang/lib/Optimizer/Dialect/FIRDialect.cpp index 6364c24137f2f3..ab6b07b3ca5bc4 100644 --- a/flang/lib/Optimizer/Dialect/FIRDialect.cpp +++ b/flang/lib/Optimizer/Dialect/FIRDialect.cpp @@ -14,7 +14,7 @@ using namespace fir; fir::FIROpsDialect::FIROpsDialect(mlir::MLIRContext *ctx) - : mlir::Dialect("fir", ctx) { + : mlir::Dialect("fir", ctx, mlir::TypeID::get()) { addTypes(); From cf26a10517676b84ac18334a11ae70d15e9df001 Mon Sep 17 00:00:00 2001 From: Sameer Arora Date: Fri, 31 Jul 2020 15:22:16 -0700 Subject: [PATCH 16/26] Add symlinks for `libtool` and `install_name_tool` Add symlinks for `llvm-libtool-darwin` and `llvm-install-name-tool`. Reviewed by jhenderson, smeenai Differential Revision: https://reviews.llvm.org/D85054 --- llvm/tools/llvm-libtool-darwin/CMakeLists.txt | 4 ++++ llvm/tools/llvm-objcopy/CMakeLists.txt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/llvm/tools/llvm-libtool-darwin/CMakeLists.txt b/llvm/tools/llvm-libtool-darwin/CMakeLists.txt index c2073990f214dc..eb83fa1a3ee935 100644 --- a/llvm/tools/llvm-libtool-darwin/CMakeLists.txt +++ b/llvm/tools/llvm-libtool-darwin/CMakeLists.txt @@ -7,3 +7,7 @@ set(LLVM_LINK_COMPONENTS add_llvm_tool(llvm-libtool-darwin llvm-libtool-darwin.cpp ) + +if(LLVM_INSTALL_CCTOOLS_SYMLINKS) + add_llvm_tool_symlink(libtool llvm-libtool-darwin) +endif() diff --git a/llvm/tools/llvm-objcopy/CMakeLists.txt b/llvm/tools/llvm-objcopy/CMakeLists.txt index 6aa5197243dc72..49eab05e9c9583 100644 --- a/llvm/tools/llvm-objcopy/CMakeLists.txt +++ b/llvm/tools/llvm-objcopy/CMakeLists.txt @@ -50,3 +50,7 @@ if(LLVM_INSTALL_BINUTILS_SYMLINKS) add_llvm_tool_symlink(objcopy llvm-objcopy) add_llvm_tool_symlink(strip llvm-objcopy) endif() + +if(LLVM_INSTALL_CCTOOLS_SYMLINKS) + add_llvm_tool_symlink(install_name_tool llvm-install-name-tool) +endif() From cd01980f308a94c64f814052a5e522ac69982237 Mon Sep 17 00:00:00 2001 From: Artem Belevich Date: Fri, 7 Aug 2020 12:59:49 -0700 Subject: [PATCH 17/26] [OpenMP] Split OpenMP/target_map_codegen test [NFC] The test file is the single longest test among clang's tests and ends up about doubling the wall time of clang tests on machines with high number of cores. The test appears to consist of multiple independent subtests and does not have to be in one file. Splitting it into smaller parts reduces test time on my machine from ~80s down to ~45. Differential Revision: https://reviews.llvm.org/D85551 --- clang/test/OpenMP/target_map_codegen.cpp | 6533 ------------------- clang/test/OpenMP/target_map_codegen_00.cpp | 104 + clang/test/OpenMP/target_map_codegen_01.cpp | 111 + clang/test/OpenMP/target_map_codegen_02.cpp | 73 + clang/test/OpenMP/target_map_codegen_03.cpp | 85 + clang/test/OpenMP/target_map_codegen_04.cpp | 80 + clang/test/OpenMP/target_map_codegen_05.cpp | 75 + clang/test/OpenMP/target_map_codegen_06.cpp | 91 + clang/test/OpenMP/target_map_codegen_07.cpp | 73 + clang/test/OpenMP/target_map_codegen_08.cpp | 70 + clang/test/OpenMP/target_map_codegen_09.cpp | 71 + clang/test/OpenMP/target_map_codegen_10.cpp | 55 + clang/test/OpenMP/target_map_codegen_11.cpp | 90 + clang/test/OpenMP/target_map_codegen_12.cpp | 101 + clang/test/OpenMP/target_map_codegen_13.cpp | 128 + clang/test/OpenMP/target_map_codegen_14.cpp | 198 + clang/test/OpenMP/target_map_codegen_15.cpp | 80 + clang/test/OpenMP/target_map_codegen_16.cpp | 76 + clang/test/OpenMP/target_map_codegen_17.cpp | 79 + clang/test/OpenMP/target_map_codegen_18.cpp | 1840 ++++++ clang/test/OpenMP/target_map_codegen_19.cpp | 147 + clang/test/OpenMP/target_map_codegen_20.cpp | 298 + clang/test/OpenMP/target_map_codegen_21.cpp | 386 ++ clang/test/OpenMP/target_map_codegen_22.cpp | 200 + clang/test/OpenMP/target_map_codegen_23.cpp | 634 ++ clang/test/OpenMP/target_map_codegen_24.cpp | 134 + clang/test/OpenMP/target_map_codegen_25.cpp | 223 + clang/test/OpenMP/target_map_codegen_26.cpp | 248 + clang/test/OpenMP/target_map_codegen_27.cpp | 92 + clang/test/OpenMP/target_map_codegen_28.cpp | 208 + clang/test/OpenMP/target_map_codegen_29.cpp | 168 + clang/test/OpenMP/target_map_codegen_30.cpp | 91 + clang/test/OpenMP/target_map_codegen_31.cpp | 197 + clang/test/OpenMP/target_map_codegen_32.cpp | 111 + clang/test/OpenMP/target_map_codegen_33.cpp | 81 + 35 files changed, 6698 insertions(+), 6533 deletions(-) delete mode 100644 clang/test/OpenMP/target_map_codegen.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_00.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_01.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_02.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_03.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_04.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_05.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_06.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_07.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_08.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_09.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_10.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_11.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_12.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_13.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_14.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_15.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_16.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_17.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_18.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_19.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_20.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_21.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_22.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_23.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_24.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_25.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_26.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_27.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_28.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_29.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_30.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_31.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_32.cpp create mode 100644 clang/test/OpenMP/target_map_codegen_33.cpp diff --git a/clang/test/OpenMP/target_map_codegen.cpp b/clang/test/OpenMP/target_map_codegen.cpp deleted file mode 100644 index a394f5b1c3d537..00000000000000 --- a/clang/test/OpenMP/target_map_codegen.cpp +++ /dev/null @@ -1,6533 +0,0 @@ -// expected-no-diagnostics -#ifndef HEADER -#define HEADER - -/// -/// Implicit maps. -/// - -///==========================================================================/// -// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-64 -// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-64 -// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-32 -// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-32 - -// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s -// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s -// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s -// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s - -// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-64 -// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-64 -// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-32 -// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-32 - -// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-64 -// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-64 -// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-32 -// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-32 - -// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s -// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s -// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s -// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s -// SIMD-ONLY0-NOT: {{__kmpc|__tgt}} - -#ifdef CK1 - -class B { -public: - static double VAR; - B() { - } - - static void modify(int &res) { -#pragma omp target map(tofrom \ - : res) - { - res = B::VAR; - } - } -}; -double B::VAR = 1.0; - -// CK1-LABEL: @.__omp_offloading_{{.*}}implicit_maps_integer{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 - -// CK1-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] -// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 -// CK1-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] - -// CK1-LABEL: implicit_maps_integer{{.*}}( -void implicit_maps_integer (int a){ - // CK1: call void{{.*}}modify - B::modify(a); - int i = a; - - // CK1-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK1-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK1-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK1-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK1-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK1-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* - // CK1-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* - // CK1-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] - // CK1-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] - // CK1-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], - // CK1-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* - // CK1-64-DAG: store i32 {{.+}}, i32* [[CADDR]], - - // CK1: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) - #pragma omp target - { - ++i; - } -} - -// CK1: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) -// CK1: [[ADDR:%.+]] = alloca i[[sz]], -// CK1: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], -// CK1-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32* -// CK1-64: {{.+}} = load i32, i32* [[CADDR]], -// CK1-32: {{.+}} = load i32, i32* [[ADDR]], - -#endif - - -///==========================================================================/// -// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-64 -// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-64 -// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-32 -// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-32 - -// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-64 -// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-64 -// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-32 -// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-32 - -// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-64 -// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-64 -// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-32 -// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-32 - -// RUN: %clang_cc1 -DCK2 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY1 %s -// RUN: %clang_cc1 -DCK2 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY1 %s -// RUN: %clang_cc1 -DCK2 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY1 %s -// RUN: %clang_cc1 -DCK2 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY1 %s -// SIMD-ONLY1-NOT: {{__kmpc|__tgt}} -#ifdef CK2 - -// CK2-LABEL: @.__omp_offloading_{{.*}}implicit_maps_reference{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 - -// CK2: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] -// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 -// CK2: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] -// CK2-LABEL: @.__omp_offloading_{{.*}}implicit_maps_reference{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK2: [[SIZES2:@.+]] = {{.+}}constant [1 x i64] zeroinitializer -// Map types: OMP_MAP_IS_PTR | OMP_MAP_IMPLICIT = 544 -// CK2: [[TYPES2:@.+]] = {{.+}}constant [1 x i64] [i64 544] - -// CK2-LABEL: implicit_maps_reference{{.*}}( -void implicit_maps_reference (int a, int *b){ - int &i = a; - // CK2-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK2-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* - // CK2-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* - // CK2-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] - // CK2-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] - // CK2-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], - // CK2-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* - // CK2-64-DAG: store i32 {{.+}}, i32* [[CADDR]], - - // CK2: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) - #pragma omp target - { - ++i; - } - - int *&p = b; - // CK2-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES2]]{{.+}}, {{.+}}[[TYPES2]]{{.+}}, i8** null) - // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK2-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** - // CK2-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK2-DAG: store i32* [[VAL:%[^,]+]], i32** [[CBP1]] - // CK2-DAG: store i32* [[VAL]], i32** [[CP1]] - // CK2-DAG: [[VAL]] = load i32*, i32** [[ADDR:%.+]], - // CK2-DAG: [[ADDR]] = load i32**, i32*** [[ADDR2:%.+]], - - // CK2: call void [[KERNEL2:@.+]](i32* [[VAL]]) - #pragma omp target - { - ++p; - } -} - -// CK2: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) -// CK2: [[ADDR:%.+]] = alloca i[[sz]], -// CK2: [[REF:%.+]] = alloca i32*, -// CK2: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], -// CK2-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* -// CK2-64: store i32* [[CADDR]], i32** [[REF]], -// CK2-64: [[RVAL:%.+]] = load i32*, i32** [[REF]], -// CK2-64: {{.+}} = load i32, i32* [[RVAL]], -// CK2-32: store i32* [[ADDR]], i32** [[REF]], -// CK2-32: [[RVAL:%.+]] = load i32*, i32** [[REF]], -// CK2-32: {{.+}} = load i32, i32* [[RVAL]], - -// CK2: define internal void [[KERNEL2]](i32* [[ARG:%.+]]) -// CK2: [[ADDR:%.+]] = alloca i32*, -// CK2: [[REF:%.+]] = alloca i32**, -// CK2: store i32* [[ARG]], i32** [[ADDR]], -// CK2: store i32** [[ADDR]], i32*** [[REF]], -// CK2: [[T:%.+]] = load i32**, i32*** [[REF]], -// CK2: [[TT:%.+]] = load i32*, i32** [[T]], -// CK2: getelementptr inbounds i32, i32* [[TT]], i32 1 -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-64 -// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-64 -// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-32 -// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-32 - -// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-64 -// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-64 -// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-32 -// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-32 - -// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-64 -// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-64 -// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-32 -// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-32 - -// RUN: %clang_cc1 -DCK3 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY2 %s -// RUN: %clang_cc1 -DCK3 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY2 %s -// RUN: %clang_cc1 -DCK3 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY2 %s -// RUN: %clang_cc1 -DCK3 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY2 %s -// SIMD-ONLY2-NOT: {{__kmpc|__tgt}} -#ifdef CK3 - -// CK3-LABEL: @.__omp_offloading_{{.*}}implicit_maps_parameter{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 - -// CK3-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] -// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 -// CK3-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] - -// CK3-LABEL: implicit_maps_parameter{{.*}}( -void implicit_maps_parameter (int a){ - - // CK3-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK3-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK3-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK3-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK3-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK3-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* - // CK3-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* - // CK3-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] - // CK3-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] - // CK3-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], - // CK3-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* - // CK3-64-DAG: store i32 {{.+}}, i32* [[CADDR]], - - // CK3: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) - #pragma omp target - { - ++a; - } -} - -// CK3: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) -// CK3: [[ADDR:%.+]] = alloca i[[sz]], -// CK3: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], -// CK3-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32* -// CK3-64: {{.+}} = load i32, i32* [[CADDR]], -// CK3-32: {{.+}} = load i32, i32* [[ADDR]], - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64 -// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64 -// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32 -// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32 - -// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64 -// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64 -// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32 -// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32 - -// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64 -// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64 -// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32 -// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32 - -// RUN: %clang_cc1 -DCK4 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY3 %s -// RUN: %clang_cc1 -DCK4 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY3 %s -// RUN: %clang_cc1 -DCK4 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY3 %s -// RUN: %clang_cc1 -DCK4 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY3 %s -// SIMD-ONLY3-NOT: {{__kmpc|__tgt}} -#ifdef CK4 - -// CK4-LABEL: @.__omp_offloading_{{.*}}implicit_maps_nested_integer{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 - -// CK4-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] -// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 -// CK4-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] - -// CK4-LABEL: implicit_maps_nested_integer{{.*}}( -void implicit_maps_nested_integer (int a){ - int i = a; - - // The captures in parallel are by reference. Only the capture in target is by - // copy. - - // CK4: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP1:@.+]] to void (i32*, i32*, ...)*), i32* {{.+}}) - // CK4: define internal void [[KERNELP1]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}}) - #pragma omp parallel - { - // CK4-DAG: call i32 @__tgt_target_teams_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null, i32 1, i32 0) - // CK4-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK4-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK4-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK4-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK4-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* - // CK4-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* - // CK4-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] - // CK4-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] - // CK4-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], - // CK4-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* - // CK4-64-DAG: store i32 {{.+}}, i32* [[CADDR]], - - // CK4: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) - #pragma omp target - { - #pragma omp parallel - { - ++i; - } - } - } -} - -// CK4: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) -// CK4: [[ADDR:%.+]] = alloca i[[sz]], -// CK4: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], -// CK4-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32* -// CK4-64: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[CADDR]]) -// CK4-32: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[ADDR]]) -// CK4: define internal void [[KERNELP2]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}}) -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-64 -// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-64 -// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-32 -// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-32 - -// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-64 -// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-64 -// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-32 -// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-32 - -// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-64 -// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-64 -// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-32 -// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-32 - -// RUN: %clang_cc1 -DCK5 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY4 %s -// RUN: %clang_cc1 -DCK5 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY4 %s -// RUN: %clang_cc1 -DCK5 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY4 %s -// RUN: %clang_cc1 -DCK5 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY4 %s -// SIMD-ONLY4-NOT: {{__kmpc|__tgt}} -#ifdef CK5 - -// CK5-LABEL: @.__omp_offloading_{{.*}}implicit_maps_nested_integer_and_enum{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 - -// CK5-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] -// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 -// CK5-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] - -// CK5-LABEL: implicit_maps_nested_integer_and_enum{{.*}}( -void implicit_maps_nested_integer_and_enum (int a){ - enum Bla { - SomeEnum = 0x09 - }; - - // Using an enum should not change the mapping information. - int i = a; - - // CK5-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK5-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK5-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK5-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK5-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK5-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* - // CK5-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* - // CK5-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] - // CK5-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] - // CK5-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], - // CK5-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* - // CK5-64-DAG: store i32 {{.+}}, i32* [[CADDR]], - - // CK5: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) - #pragma omp target - { - ++i; - i += SomeEnum; - } -} - -// CK5: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) -// CK5: [[ADDR:%.+]] = alloca i[[sz]], -// CK5: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], -// CK5-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32* -// CK5-64: {{.+}} = load i32, i32* [[CADDR]], -// CK5-32: {{.+}} = load i32, i32* [[ADDR]], - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-64 -// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-64 -// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-32 -// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-32 - -// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-64 -// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-64 -// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-32 -// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-32 - -// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-64 -// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-64 -// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-32 -// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-32 - -// RUN: %clang_cc1 -DCK6 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY5 %s -// RUN: %clang_cc1 -DCK6 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY5 %s -// RUN: %clang_cc1 -DCK6 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY5 %s -// RUN: %clang_cc1 -DCK6 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY5 %s -// SIMD-ONLY5-NOT: {{__kmpc|__tgt}} -#ifdef CK6 -// CK6-DAG: @.__omp_offloading_{{.*}}implicit_maps_host_global{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 - -// CK6-DAG: [[GBL:@Gi]] = global i32 0 -// CK6-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] -// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 -// CK6-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] - -// CK6-LABEL: implicit_maps_host_global{{.*}}( -int Gi; -void implicit_maps_host_global (int a){ - // CK6-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK6-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK6-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK6-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK6-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK6-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* - // CK6-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* - // CK6-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] - // CK6-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] - // CK6-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], - // CK6-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* - // CK6-64-DAG: store i32 [[GBLVAL:%.+]], i32* [[CADDR]], - // CK6-64-DAG: [[GBLVAL]] = load i32, i32* [[GBL]], - // CK6-32-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[GBLVAL:%.+]], - - // CK6: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) - #pragma omp target - { - ++Gi; - } -} - -// CK6: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) -// CK6: [[ADDR:%.+]] = alloca i[[sz]], -// CK6: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], -// CK6-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32* -// CK6-64: {{.+}} = load i32, i32* [[CADDR]], -// CK6-32: {{.+}} = load i32, i32* [[ADDR]], - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-64 -// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-64 -// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-32 -// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-32 - -// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-64 -// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-64 -// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-32 -// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-32 - -// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-64 -// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-64 -// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-32 -// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-32 - -// RUN: %clang_cc1 -DCK7 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s -// RUN: %clang_cc1 -DCK7 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s -// RUN: %clang_cc1 -DCK7 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s -// RUN: %clang_cc1 -DCK7 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s -// SIMD-ONLY6-NOT: {{__kmpc|__tgt}} -#ifdef CK7 - -// For a 32-bit targets, the value doesn't fit the size of the pointer, -// therefore it is passed by reference with a map 'to' specification. - -// CK7-LABEL: @.__omp_offloading_{{.*}}implicit_maps_double{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 - -// CK7-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] -// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 -// CK7-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] -// Map types: OMP_MAP_TO | OMP_MAP_PRIVATE | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 673 -// CK7-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 673] - -// CK7-LABEL: implicit_maps_double{{.*}}( -void implicit_maps_double (int a){ - double d = (double)a; - - // CK7-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK7-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK7-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK7-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK7-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - - // CK7-64-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* - // CK7-64-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* - // CK7-64-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] - // CK7-64-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] - // CK7-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], - // CK7-64-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to double* - // CK7-64-64-DAG: store double {{.+}}, double* [[CADDR]], - - // CK7-32-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double** - // CK7-32-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double** - // CK7-32-DAG: store double* [[DECL:%[^,]+]], double** [[CBP1]] - // CK7-32-DAG: store double* [[DECL]], double** [[CP1]] - - // CK7-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) - // CK7-32: call void [[KERNEL:@.+]](double* [[DECL]]) - #pragma omp target - { - d += 1.0; - } -} - -// CK7-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) -// CK7-64: [[ADDR:%.+]] = alloca i[[sz]], -// CK7-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], -// CK7-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to double* -// CK7-64: {{.+}} = load double, double* [[CADDR]], - -// CK7-32: define internal void [[KERNEL]](double* {{.+}}[[ARG:%.+]]) -// CK7-32: [[ADDR:%.+]] = alloca double*, -// CK7-32: store double* [[ARG]], double** [[ADDR]], -// CK7-32: [[REF:%.+]] = load double*, double** [[ADDR]], -// CK7-32: {{.+}} = load double, double* [[REF]], - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 -// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 -// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 -// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 - -// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 -// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 -// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 -// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 - -// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 -// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 -// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 -// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 - -// RUN: %clang_cc1 -DCK8 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY7 %s -// RUN: %clang_cc1 -DCK8 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY7 %s -// RUN: %clang_cc1 -DCK8 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY7 %s -// RUN: %clang_cc1 -DCK8 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY7 %s -// SIMD-ONLY7-NOT: {{__kmpc|__tgt}} -#ifdef CK8 - -// CK8-LABEL: @.__omp_offloading_{{.*}}implicit_maps_float{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 - -// CK8-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] -// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 -// CK8-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] - -// CK8-LABEL: implicit_maps_float{{.*}}( -void implicit_maps_float (int a){ - float f = (float)a; - - // CK8-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK8-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK8-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK8-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK8-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK8-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* - // CK8-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* - // CK8-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] - // CK8-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] - // CK8-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], - // CK8-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float* - // CK8-DAG: store float {{.+}}, float* [[CADDR]], - - // CK8: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) - #pragma omp target - { - f += 1.0; - } -} - -// CK8: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) -// CK8: [[ADDR:%.+]] = alloca i[[sz]], -// CK8: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], -// CK8: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float* -// CK8: {{.+}} = load float, float* [[CADDR]], - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 -// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 -// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 -// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 - -// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 -// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 -// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 -// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 - -// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 -// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 -// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 -// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 - -// RUN: %clang_cc1 -DCK9 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s -// RUN: %clang_cc1 -DCK9 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s -// RUN: %clang_cc1 -DCK9 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s -// RUN: %clang_cc1 -DCK9 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s -// SIMD-ONLY8-NOT: {{__kmpc|__tgt}} -#ifdef CK9 - -// CK9-LABEL: @.__omp_offloading_{{.*}}implicit_maps_array{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 - -// CK9-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] -// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547 -// CK9-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 547] - -// CK9-LABEL: implicit_maps_array{{.*}}( -void implicit_maps_array (int a){ - double darr[2] = {(double)a, (double)a}; - - // CK9-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK9-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK9-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK9-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK9-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK9-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [2 x double]** - // CK9-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [2 x double]** - // CK9-DAG: store [2 x double]* [[DECL:%[^,]+]], [2 x double]** [[CBP1]] - // CK9-DAG: store [2 x double]* [[DECL]], [2 x double]** [[CP1]] - - // CK9: call void [[KERNEL:@.+]]([2 x double]* [[DECL]]) - #pragma omp target - { - darr[0] += 1.0; - darr[1] += 1.0; - } -} - -// CK9: define internal void [[KERNEL]]([2 x double]* {{.+}}[[ARG:%.+]]) -// CK9: [[ADDR:%.+]] = alloca [2 x double]*, -// CK9: store [2 x double]* [[ARG]], [2 x double]** [[ADDR]], -// CK9: [[REF:%.+]] = load [2 x double]*, [2 x double]** [[ADDR]], -// CK9: {{.+}} = getelementptr inbounds [2 x double], [2 x double]* [[REF]], i{{64|32}} 0, i{{64|32}} 0 -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 -// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 -// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 -// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 - -// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 -// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 -// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 -// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 - -// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 -// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 -// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 -// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 - -// RUN: %clang_cc1 -DCK10 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s -// RUN: %clang_cc1 -DCK10 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s -// RUN: %clang_cc1 -DCK10 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s -// RUN: %clang_cc1 -DCK10 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s -// SIMD-ONLY9-NOT: {{__kmpc|__tgt}} -#ifdef CK10 - -// CK10-LABEL: @.__omp_offloading_{{.*}}implicit_maps_pointer{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 - -// CK10-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] zeroinitializer -// Map types: OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 544 -// CK10-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 544] - -// CK10-LABEL: implicit_maps_pointer{{.*}}( -void implicit_maps_pointer (){ - double *ddyn; - - // CK10-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK10-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK10-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK10-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK10-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK10-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double** - // CK10-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double** - // CK10-DAG: store double* [[PTR:%[^,]+]], double** [[CBP1]] - // CK10-DAG: store double* [[PTR]], double** [[CP1]] - - // CK10: call void [[KERNEL:@.+]](double* [[PTR]]) - #pragma omp target - { - ddyn[0] += 1.0; - ddyn[1] += 1.0; - } -} - -// CK10: define internal void [[KERNEL]](double* {{.*}}[[ARG:%.+]]) -// CK10: [[ADDR:%.+]] = alloca double*, -// CK10: store double* [[ARG]], double** [[ADDR]], -// CK10: [[REF:%.+]] = load double*, double** [[ADDR]], -// CK10: {{.+}} = getelementptr inbounds double, double* [[REF]], i{{64|32}} 0 - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11 -// RUN: %clang_cc1 -DCK11 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11 -// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11 -// RUN: %clang_cc1 -DCK11 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11 - -// RUN: %clang_cc1 -DCK11 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s -// RUN: %clang_cc1 -DCK11 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s -// RUN: %clang_cc1 -DCK11 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s -// RUN: %clang_cc1 -DCK11 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s -// SIMD-ONLY10-NOT: {{__kmpc|__tgt}} -#ifdef CK11 - -// CK11-LABEL: @.__omp_offloading_{{.*}}implicit_maps_double_complex{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 - -// CK11-DAG: [[SIZES:@.+]] = {{.+}}constant [2 x i64] [i64 16, i64 {{8|4}}] -// Map types: OMP_MAP_TO | OMP_MAP_FROM | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547 -// CK11-DAG: [[TYPES:@.+]] = {{.+}}constant [2 x i64] [i64 547, i64 547] - -// CK11-LABEL: implicit_maps_double_complex{{.*}}( -void implicit_maps_double_complex (int a, int *b){ - double _Complex dc = (double)a; - - // CK11-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK11-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK11-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK11-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK11-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK11-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to { double, double }** - // CK11-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to { double, double }** - // CK11-DAG: store { double, double }* [[PTR:%[^,]+]], { double, double }** [[CBP1]] - // CK11-DAG: store { double, double }* [[PTR]], { double, double }** [[CP1]] - - // CK11: call void [[KERNEL:@.+]]({ double, double }* [[PTR]], i32** %{{.+}}) - #pragma omp target defaultmap(tofrom:scalar) - { - dc *= dc; *b = 1; - } -} - -// CK11: define internal void [[KERNEL]]({ double, double }* {{.*}}[[ARG:%.+]], i32** {{.*}}) -// CK11: [[ADDR:%.+]] = alloca { double, double }*, -// CK11: store { double, double }* [[ARG]], { double, double }** [[ADDR]], -// CK11: [[REF:%.+]] = load { double, double }*, { double, double }** [[ADDR]], -// CK11: {{.+}} = getelementptr inbounds { double, double }, { double, double }* [[REF]], i32 0, i32 0 -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-64 -// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-64 -// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-32 -// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-32 - -// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-64 -// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-64 -// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-32 -// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-32 - -// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-64 -// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-64 -// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-32 -// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-32 - -// RUN: %clang_cc1 -DCK12 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY11 %s -// RUN: %clang_cc1 -DCK12 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY11 %s -// RUN: %clang_cc1 -DCK12 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY11 %s -// RUN: %clang_cc1 -DCK12 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY11 %s -// SIMD-ONLY11-NOT: {{__kmpc|__tgt}} -#ifdef CK12 - -// For a 32-bit targets, the value doesn't fit the size of the pointer, -// therefore it is passed by reference with a map 'to' specification. - -// CK12-LABEL: @.__omp_offloading_{{.*}}implicit_maps_float_complex{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 - -// CK12-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] -// Map types: OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 -// CK12-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] -// Map types: OMP_MAP_TO | OMP_MAP_PRIVATE | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 673 -// CK12-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 673] - -// CK12-LABEL: implicit_maps_float_complex{{.*}}( -void implicit_maps_float_complex (int a){ - float _Complex fc = (float)a; - - // CK12-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK12-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK12-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK12-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK12-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - - // CK12-64-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* - // CK12-64-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* - // CK12-64-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] - // CK12-64-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] - // CK12-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], - // CK12-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }* - // CK12-64-DAG: store { float, float } {{.+}}, { float, float }* [[CADDR]], - - // CK12-32-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to { float, float }** - // CK12-32-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to { float, float }** - // CK12-32-DAG: store { float, float }* [[DECL:%[^,]+]], { float, float }** [[CBP1]] - // CK12-32-DAG: store { float, float }* [[DECL]], { float, float }** [[CP1]] - - // CK12-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) - // CK12-32: call void [[KERNEL:@.+]]({ float, float }* [[DECL]]) - #pragma omp target - { - fc *= fc; - } -} - -// CK12-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) -// CK12-64: [[ADDR:%.+]] = alloca i[[sz]], -// CK12-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], -// CK12-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }* -// CK12-64: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[CADDR]], i32 0, i32 0 - -// CK12-32: define internal void [[KERNEL]]({ float, float }* {{.+}}[[ARG:%.+]]) -// CK12-32: [[ADDR:%.+]] = alloca { float, float }*, -// CK12-32: store { float, float }* [[ARG]], { float, float }** [[ADDR]], -// CK12-32: [[REF:%.+]] = load { float, float }*, { float, float }** [[ADDR]], -// CK12-32: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[REF]], i32 0, i32 0 -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 -// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 -// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 -// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 - -// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 -// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 -// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 -// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 - -// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 -// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 -// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 -// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 - -// RUN: %clang_cc1 -DCK13 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s -// RUN: %clang_cc1 -DCK13 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s -// RUN: %clang_cc1 -DCK13 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s -// RUN: %clang_cc1 -DCK13 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s -// SIMD-ONLY12-NOT: {{__kmpc|__tgt}} -#ifdef CK13 - -// CK13-LABEL: @.__omp_offloading_{{.*}}implicit_maps_variable_length_array{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 - -// We don't have a constant map size for VLAs. -// Map types: -// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM + OMP_MAP_IMPLICIT = 800 (vla size) -// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM + OMP_MAP_IMPLICIT = 800 (vla size) -// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547 -// CK13-DAG: [[TYPES:@.+]] = {{.+}}constant [3 x i64] [i64 800, i64 800, i64 547] - -// CK13-LABEL: implicit_maps_variable_length_array{{.*}}( -void implicit_maps_variable_length_array (int a){ - double vla[2][a]; - - // CK13-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 3, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i64* [[SGEP:%[^,]+]], {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK13-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK13-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK13-DAG: [[SGEP]] = getelementptr inbounds {{.+}}[[SS:%[^,]+]], i32 0, i32 0 - - // CK13-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK13-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK13-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 0 - // CK13-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[sz:64|32]]* - // CK13-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[sz]]* - // CK13-DAG: store i[[sz]] 2, i[[sz]]* [[CBP0]] - // CK13-DAG: store i[[sz]] 2, i[[sz]]* [[CP0]] - // CK13-DAG: store i64 {{8|4}}, i64* [[S0]], - - // CK13-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1 - // CK13-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1 - // CK13-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 1 - // CK13-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]* - // CK13-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* - // CK13-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]] - // CK13-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] - // CK13-DAG: store i64 {{8|4}}, i64* [[S1]], - - // CK13-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2 - // CK13-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2 - // CK13-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 2 - // CK13-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double** - // CK13-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** - // CK13-DAG: store double* [[DECL:%.+]], double** [[CBP2]] - // CK13-DAG: store double* [[DECL]], double** [[CP2]] - // CK13-DAG: store i64 [[VALS2:%.+]], i64* [[S2]], - // CK13-DAG: [[VALS2]] = {{mul nuw i64 %.+, 8|sext i32 %.+ to i64}} - - // CK13: call void [[KERNEL:@.+]](i[[sz]] {{.+}}, i[[sz]] {{.+}}, double* [[DECL]]) - #pragma omp target - { - vla[1][3] += 1.0; - } -} - -// CK13: define internal void [[KERNEL]](i[[sz]] [[VLA0:%.+]], i[[sz]] [[VLA1:%.+]], double* {{.*}}[[ARG:%.+]]) -// CK13: [[ADDR0:%.+]] = alloca i[[sz]], -// CK13: [[ADDR1:%.+]] = alloca i[[sz]], -// CK13: [[ADDR2:%.+]] = alloca double*, -// CK13: store i[[sz]] [[VLA0]], i[[sz]]* [[ADDR0]], -// CK13: store i[[sz]] [[VLA1]], i[[sz]]* [[ADDR1]], -// CK13: store double* [[ARG]], double** [[ADDR2]], -// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR0]], -// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR1]], -// CK13: [[REF:%.+]] = load double*, double** [[ADDR2]], -// CK13: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] %{{.+}} -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-64 -// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-64 -// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-32 -// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-32 - -// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-64 -// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-64 -// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-32 -// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-32 - -// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-64 -// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-64 -// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-32 -// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-32 - -// RUN: %clang_cc1 -DCK14 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY13 %s -// RUN: %clang_cc1 -DCK14 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY13 %s -// RUN: %clang_cc1 -DCK14 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY13 %s -// RUN: %clang_cc1 -DCK14 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY13 %s -// SIMD-ONLY13-NOT: {{__kmpc|__tgt}} -#ifdef CK14 - -// CK14-DAG: [[ST:%.+]] = type { i32, double } - -// CK14-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 - - -// Map types: -// - OMP_MAP_TARGET_PARAM = 32 -// - OMP_MAP_TO + OMP_MAP_FROM | OMP_MAP_IMPLICIT | OMP_MAP_MEMBER_OF = 281474976711171 -// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 -// CK14-DAG: [[TYPES:@.+]] = {{.+}}constant [4 x i64] [i64 32, i64 281474976711171, i64 281474976711171, i64 800] - -class SSS { -public: - int a; - double b; - - void foo(int c) { - #pragma omp target - { - a += c; - b += (double)c; - } - } - - SSS(int a, double b) : a(a), b(b) {} -}; - -// CK14-LABEL: implicit_maps_class{{.*}}( -void implicit_maps_class (int a){ - SSS sss(a, (double)a); - - // CK14: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}}) - // CK14-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 4, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i64* [[SIZES:%[^,]+]], {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK14-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK14-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK14-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]], i32 0, i32 0 - - // CK14-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK14-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK14-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 0 - // CK14-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** - // CK14-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK14-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]] - // CK14-DAG: store i32* [[A:%.+]], i32** [[CP0]] - // CK14-DAG: store i64 %{{.+}}, i64* [[S0]] - - // CK14-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1 - // CK14-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1 - // CK14-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 1 - // CK14-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** - // CK14-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK14-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP1]] - // CK14-DAG: store i32* [[A]], i32** [[CP1]] - // CK14-DAG: store i64 4, i64* [[S1]] - - // CK14-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2 - // CK14-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2 - // CK14-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 2 - // CK14-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]** - // CK14-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** - // CK14-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP2]] - // CK14-DAG: store double* %{{.+}}, double** [[CP2]] - // CK14-DAG: store i64 8, i64* [[S2]] - - // CK14-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 3 - // CK14-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 3 - // CK14-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 3 - // CK14-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to i[[sz:64|32]]* - // CK14-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i[[sz]]* - // CK14-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP3]] - // CK14-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP3]] - // CK14-DAG: store i64 4, i64* [[S3]] - // CK14-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], - // CK14-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* - // CK14-64-DAG: store i32 {{.+}}, i32* [[CADDR]], - - // CK14: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}}) - sss.foo(123); -} - -// CK14: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]]) -// CK14: [[ADDR0:%.+]] = alloca [[ST]]*, -// CK14: [[ADDR1:%.+]] = alloca i[[sz]], -// CK14: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]], -// CK14: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]], -// CK14: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]], -// CK14-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32* -// CK14-64: {{.+}} = load i32, i32* [[CADDR1]], -// CK14-32: {{.+}} = load i32, i32* [[ADDR1]], -// CK14: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0 - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-64 -// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-64 -// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-32 -// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-32 - -// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-64 -// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-64 -// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-32 -// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-32 - -// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-64 -// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-64 -// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-32 -// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-32 - -// RUN: %clang_cc1 -DCK15 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY14 %s -// RUN: %clang_cc1 -DCK15 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY14 %s -// RUN: %clang_cc1 -DCK15 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY14 %s -// RUN: %clang_cc1 -DCK15 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY14 %s -// SIMD-ONLY14-NOT: {{__kmpc|__tgt}} -#ifdef CK15 - -// CK15: [[ST:%.+]] = type { i32, double } -// Map types: -// - OMP_MAP_TARGET_PARAM = 32 -// - OMP_MAP_TO + OMP_MAP_FROM | OMP_MAP_IMPLICIT | OMP_MAP_MEMBER_OF = 281474976711171 -// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 -// CK15: [[TYPES:@.+]] = {{.+}}constant [4 x i64] [i64 32, i64 281474976711171, i64 281474976711171, i64 800] - -// Map types: -// - OMP_MAP_TARGET_PARAM = 32 -// - OMP_MAP_TO + OMP_MAP_FROM | OMP_MAP_IMPLICIT | OMP_MAP_MEMBER_OF = 281474976711171 -// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 -// CK15: [[TYPES2:@.+]] = {{.+}}constant [4 x i64] [i64 32, i64 281474976711171, i64 281474976711171, i64 800] - -template -class SSST { -public: - int a; - double b; - - void foo(int c) { - #pragma omp target - { - a += c + x; - b += (double)(c + x); - } - } - template - void bar(int c) { - #pragma omp target - { - a += c + x + y; - b += (double)(c + x + y); - } - } - - SSST(int a, double b) : a(a), b(b) {} -}; - -// CK15-LABEL: implicit_maps_templated_class{{.*}}( -void implicit_maps_templated_class (int a){ - SSST<123> ssst(a, (double)a); - - // CK15: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}}) - // CK15-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 4, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i64* [[SIZES:%[^,]+]], {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK15-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]], i32 0, i32 0 - - // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK15-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 0 - // CK15-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** - // CK15-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK15-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]] - // CK15-DAG: store i32* [[A:%.+]], i32** [[CP0]] - // CK15-DAG: store i64 %{{.+}}, i64* [[S0]] - - // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1 - // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1 - // CK15-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 1 - // CK15-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** - // CK15-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP1]] - // CK15-DAG: store i32* [[A]], i32** [[CP1]] - // CK15-DAG: store i64 4, i64* [[S1]] - - // CK15-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2 - // CK15-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2 - // CK15-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 2 - // CK15-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]** - // CK15-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** - // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP2]] - // CK15-DAG: store double* %{{.+}}, double** [[CP2]] - // CK15-DAG: store i64 8, i64* [[S2]] - - // CK15-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 3 - // CK15-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 3 - // CK15-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 3 - // CK15-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to i[[sz:64|32]]* - // CK15-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i[[sz]]* - // CK15-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP3]] - // CK15-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP3]] - // CK15-DAG: store i64 4, i64* [[S3]] - // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], - // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* - // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]], - - // CK15: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}}) - ssst.foo(456); - - // CK15: define {{.*}}void @{{.+}}bar{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}}) - // CK15-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 4, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i64* [[SIZES:[^,]+]], {{.+}}[[TYPES2]]{{.+}}, i8** null) - // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK15-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]], i32 0, i32 0 - - // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK15-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 0 - // CK15-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** - // CK15-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK15-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]] - // CK15-DAG: store i32* [[A:%.+]], i32** [[CP0]] - // CK15-DAG: store i64 %{{.+}}, i64* [[S0]] - - // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1 - // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1 - // CK15-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 1 - // CK15-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** - // CK15-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP1]] - // CK15-DAG: store i32* [[A]], i32** [[CP1]] - // CK15-DAG: store i64 4, i64* [[S1]] - - // CK15-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2 - // CK15-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2 - // CK15-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 2 - // CK15-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]** - // CK15-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** - // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP2]] - // CK15-DAG: store double* %{{.+}}, double** [[CP2]] - // CK15-DAG: store i64 8, i64* [[S2]] - - // CK15-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 3 - // CK15-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 3 - // CK15-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 3 - // CK15-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to i[[sz]]* - // CK15-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i[[sz]]* - // CK15-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP3]] - // CK15-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP3]] - // CK15-DAG: store i64 4, i64* [[S3]] - // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], - // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* - // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]], - - // CK15: call void [[KERNEL2:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}}) - ssst.bar<210>(789); -} - -// CK15: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]]) -// CK15: [[ADDR0:%.+]] = alloca [[ST]]*, -// CK15: [[ADDR1:%.+]] = alloca i[[sz]], -// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]], -// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]], -// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]], -// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32* -// CK15-64: {{.+}} = load i32, i32* [[CADDR1]], -// CK15-32: {{.+}} = load i32, i32* [[ADDR1]], -// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0 - -// CK15: define internal void [[KERNEL2]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]]) -// CK15: [[ADDR0:%.+]] = alloca [[ST]]*, -// CK15: [[ADDR1:%.+]] = alloca i[[sz]], -// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]], -// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]], -// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]], -// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32* -// CK15-64: {{.+}} = load i32, i32* [[CADDR1]], -// CK15-32: {{.+}} = load i32, i32* [[ADDR1]], -// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0 - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-64 -// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-64 -// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-32 -// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-32 - -// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-64 -// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-64 -// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-32 -// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-32 - -// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-64 -// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-64 -// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-32 -// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-32 - -// RUN: %clang_cc1 -DCK16 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY15 %s -// RUN: %clang_cc1 -DCK16 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY15 %s -// RUN: %clang_cc1 -DCK16 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY15 %s -// RUN: %clang_cc1 -DCK16 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY15 %s -// SIMD-ONLY15-NOT: {{__kmpc|__tgt}} -#ifdef CK16 - -// CK16-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] -// Map types: -// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 -// CK16-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] - -template -int foo(int d) { - int res = d; - #pragma omp target - { - res += y; - } - return res; -} -// CK16-LABEL: implicit_maps_templated_function{{.*}}( -void implicit_maps_templated_function (int a){ - int i = a; - - // CK16: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}}) - // CK16-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK16-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK16-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - - // CK16-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK16-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK16-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* - // CK16-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* - // CK16-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]] - // CK16-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] - // CK16-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], - // CK16-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* - // CK16-64-DAG: store i32 {{.+}}, i32* [[CADDR]], - - // CK16: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) - i = foo<543>(i); -} -// CK16: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) -// CK16: [[ADDR:%.+]] = alloca i[[sz]], -// CK16: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], -// CK16-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32* -// CK16-64: {{.+}} = load i32, i32* [[CADDR]], -// CK16-32: {{.+}} = load i32, i32* [[ADDR]], - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 -// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 -// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 -// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 - -// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 -// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 -// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 -// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 - -// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 -// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 -// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 -// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 - -// RUN: %clang_cc1 -DCK17 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s -// RUN: %clang_cc1 -DCK17 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s -// RUN: %clang_cc1 -DCK17 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s -// RUN: %clang_cc1 -DCK17 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s -// SIMD-ONLY16-NOT: {{__kmpc|__tgt}} -#ifdef CK17 - -// CK17-DAG: [[ST:%.+]] = type { i32, double } -// CK17-LABEL: @.__omp_offloading_{{.*}}implicit_maps_struct{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK17-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 {{16|12}}] -// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547 -// CK17-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 547] - -class SSS { -public: - int a; - double b; -}; - -// CK17-LABEL: implicit_maps_struct{{.*}}( -void implicit_maps_struct (int a){ - SSS s = {a, (double)a}; - - // CK17-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK17-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK17-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK17-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK17-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK17-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** - // CK17-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[ST]]** - // CK17-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP1]] - // CK17-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CP1]] - - // CK17: call void [[KERNEL:@.+]]([[ST]]* [[DECL]]) - #pragma omp target - { - s.a += 1; - s.b += 1.0; - } -} - -// CK17: define internal void [[KERNEL]]([[ST]]* {{.+}}[[ARG:%.+]]) -// CK17: [[ADDR:%.+]] = alloca [[ST]]*, -// CK17: store [[ST]]* [[ARG]], [[ST]]** [[ADDR]], -// CK17: [[REF:%.+]] = load [[ST]]*, [[ST]]** [[ADDR]], -// CK17: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF]], i32 0, i32 0 -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-64 -// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-64 -// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-32 -// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-32 - -// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-64 -// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-64 -// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-32 -// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-32 - -// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-64 -// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-64 -// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-32 -// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-32 - -// RUN: %clang_cc1 -DCK18 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY17 %s -// RUN: %clang_cc1 -DCK18 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY17 %s -// RUN: %clang_cc1 -DCK18 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY17 %s -// RUN: %clang_cc1 -DCK18 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY17 %s -// SIMD-ONLY17-NOT: {{__kmpc|__tgt}} -#ifdef CK18 - -// CK18-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] -// Map types: -// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 -// CK18-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] - -template -int foo(T d) { - #pragma omp target - { - d += (T)1; - } - return d; -} -// CK18-LABEL: implicit_maps_template_type_capture{{.*}}( -void implicit_maps_template_type_capture (int a){ - int i = a; - - // CK18: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}}) - // CK18-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) - // CK18-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK18-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - - // CK18-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK18-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK18-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* - // CK18-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* - // CK18-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]] - // CK18-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] - // CK18-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], - // CK18-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* - // CK18-64-DAG: store i32 {{.+}}, i32* [[CADDR]], - - // CK18: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) - i = foo(i); -} -// CK18: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) -// CK18: [[ADDR:%.+]] = alloca i[[sz]], -// CK18: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], -// CK18-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32* -// CK18-64: {{.+}} = load i32, i32* [[CADDR]], -// CK18-32: {{.+}} = load i32, i32* [[ADDR]], - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-USE -// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-USE -// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-USE -// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-USE - -// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-USE -// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-USE -// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-USE -// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-USE - -// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-USE -// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-USE -// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-USE -// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-USE - -// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s - -// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-NOUSE -// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-NOUSE -// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-NOUSE -// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-NOUSE - -// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-NOUSE -// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-NOUSE -// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-NOUSE -// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-NOUSE - -// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-NOUSE -// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-NOUSE -// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-NOUSE -// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-NOUSE - -// RUN: %clang_cc1 -DCK19 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DCK19 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DCK19 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DCK19 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s - - -// SIMD-ONLY18-NOT: {{__kmpc|__tgt}} -#ifdef CK19 - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK19: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 32] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE00n:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK19: [[MTYPE00n:@.+]] = private {{.*}}constant [1 x i64] [i64 32] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 400] -// CK19: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 33] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE02:@.+]] = private {{.*}}constant [1 x i64] [i64 240] -// CK19: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 34] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE03:@.+]] = private {{.*}}constant [1 x i64] [i64 240] -// CK19: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE04:@.+]] = private {{.*}}constant [1 x i64] [i64 400] -// CK19: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 32] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE05:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK19: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 33] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i64] [i64 32] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE08:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK19: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE09:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] -// CK19: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 34] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE10:@.+]] = private {{.*}}constant [1 x i64] [i64 240] -// CK19: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE11:@.+]] = private {{.*}}constant [1 x i64] [i64 240] -// CK19: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i64] [i64 32] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE12:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK19: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i64] [i64 33] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i64] [i64 32] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i64] [i64 33] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE15:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK19: [[MTYPE15:@.+]] = private {{.*}}constant [1 x i64] [i64 34] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19-USE: [[MTYPE16:@.+]] = private {{.*}}constant [2 x i64] [i64 800, i64 33] -// CK19-NOUSE: [[MTYPE16:@.+]] = private {{.*}}constant [1 x i64] [i64 33] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19-USE: [[SIZE17:@.+]] = private {{.*}}constant [2 x i64] [i64 {{8|4}}, i64 240] -// CK19-USE: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i64] [i64 800, i64 34] -// CK19-NOUSE: [[SIZE17:@.+]] = private {{.*}}constant [1 x i64] [i64 240] -// CK19-NOUSE: [[MTYPE17:@.+]] = private {{.*}}constant [1 x i64] [i64 34] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19-USE: [[SIZE18:@.+]] = private {{.*}}constant [2 x i64] [i64 {{8|4}}, i64 240] -// CK19-USE: [[MTYPE18:@.+]] = private {{.*}}constant [2 x i64] [i64 800, i64 35] -// CK19-NOUSE: [[SIZE18:@.+]] = private {{.*}}constant [1 x i64] [i64 240] -// CK19-NOUSE: [[MTYPE18:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19-USE: [[MTYPE19:@.+]] = private {{.*}}constant [2 x i64] [i64 800, i64 32] -// CK19-NOUSE: [[MTYPE19:@.+]] = private {{.*}}constant [1 x i64] [i64 32] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19-USE: [[SIZE20:@.+]] = private {{.*}}constant [2 x i64] [i64 {{8|4}}, i64 4] -// CK19-USE: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i64] [i64 800, i64 33] -// CK19-NOUSE: [[SIZE20:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK19-NOUSE: [[MTYPE20:@.+]] = private {{.*}}constant [1 x i64] [i64 33] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19-USE: [[MTYPE21:@.+]] = private {{.*}}constant [2 x i64] [i64 800, i64 35] -// CK19-NOUSE: [[MTYPE21:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19-USE: [[SIZE22:@.+]] = private {{.*}}constant [2 x i64] [i64 {{8|4}}, i64 4] -// CK19-USE: [[MTYPE22:@.+]] = private {{.*}}constant [2 x i64] [i64 800, i64 35] -// CK19-NOUSE: [[SIZE22:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK19-NOUSE: [[MTYPE22:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE23:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK19: [[MTYPE23:@.+]] = private {{.*}}constant [1 x i64] [i64 39] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE24:@.+]] = private {{.*}}constant [1 x i64] [i64 480] -// CK19: [[MTYPE24:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE25:@.+]] = private {{.*}}constant [1 x i64] [i64 16] -// CK19: [[MTYPE25:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE26:@.+]] = private {{.*}}constant [1 x i64] [i64 24] -// CK19: [[MTYPE26:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE27:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK19: [[MTYPE27:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE28:@.+]] = private {{.*}}constant [3 x i64] [i64 {{8|4}}, i64 {{8|4}}, i64 16] -// CK19: [[MTYPE28:@.+]] = private {{.*}}constant [3 x i64] [i64 35, i64 16, i64 19] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE29:@.+]] = private {{.*}}constant [3 x i64] [i64 {{8|4}}, i64 {{8|4}}, i64 4] -// CK19: [[MTYPE29:@.+]] = private {{.*}}constant [3 x i64] [i64 35, i64 16, i64 19] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19-USE: [[MTYPE30:@.+]] = private {{.*}}constant [4 x i64] [i64 800, i64 800, i64 800, i64 35] -// CK19-NOUSE: [[MTYPE30:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19-USE: [[SIZE31:@.+]] = private {{.*}}constant [4 x i64] [i64 {{8|4}}, i64 {{8|4}}, i64 {{8|4}}, i64 40] -// CK19-USE: [[MTYPE31:@.+]] = private {{.*}}constant [4 x i64] [i64 800, i64 800, i64 800, i64 35] -// CK19-NOUSE: [[SIZE31:@.+]] = private {{.*}}constant [1 x i64] [i64 40] -// CK19-NOUSE: [[MTYPE31:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE32:@.+]] = private {{.*}}constant [1 x i64] [i64 13728] -// CK19: [[MTYPE32:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE33:@.+]] = private {{.*}}constant [1 x i64] [i64 13728] -// CK19: [[MTYPE33:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE34:@.+]] = private {{.*}}constant [1 x i64] [i64 13728] -// CK19: [[MTYPE34:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[MTYPE35:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE36:@.+]] = private {{.*}}constant [1 x i64] [i64 208] -// CK19: [[MTYPE36:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19-USE: [[MTYPE37:@.+]] = private {{.*}}constant [3 x i64] [i64 800, i64 800, i64 35] -// CK19-NOUSE: [[MTYPE37:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19-USE: [[MTYPE38:@.+]] = private {{.*}}constant [3 x i64] [i64 800, i64 800, i64 35] -// CK19-NOUSE: [[MTYPE38:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19-USE: [[MTYPE39:@.+]] = private {{.*}}constant [3 x i64] [i64 800, i64 800, i64 35] -// CK19-NOUSE: [[MTYPE39:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19-USE: [[MTYPE40:@.+]] = private {{.*}}constant [3 x i64] [i64 800, i64 800, i64 35] -// CK19-NOUSE: [[MTYPE40:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19-USE: [[SIZE41:@.+]] = private {{.*}}constant [3 x i64] [i64 {{8|4}}, i64 {{8|4}}, i64 208] -// CK19-USE: [[MTYPE41:@.+]] = private {{.*}}constant [3 x i64] [i64 800, i64 800, i64 35] -// CK19-NOUSE: [[SIZE41:@.+]] = private {{.*}}constant [1 x i64] [i64 208] -// CK19-NOUSE: [[MTYPE41:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE42:@.+]] = private {{.*}}constant [3 x i64] [i64 {{8|4}}, i64 {{8|4}}, i64 104] -// CK19: [[MTYPE42:@.+]] = private {{.*}}constant [3 x i64] [i64 35, i64 16, i64 19] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[MTYPE43:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK19: [[SIZE44:@.+]] = private {{.*}}constant [1 x i64] [i64 320] -// CK19: [[MTYPE44:@.+]] = private {{.*}}constant [1 x i64] [i64 34] - -// CK19-LABEL: explicit_maps_single{{.*}}( -void explicit_maps_single (int ii){ - // Map of a scalar. - int a = ii; - - // Region 00 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]] - - // CK19-USE: call void [[CALL00:@.+]](i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL00:@.+]]() - #pragma omp target map(alloc:a) - { -#ifdef USE - ++a; -#endif - } - - // Map of a scalar in nested region. - int b = a; - - // Region 00n - // CK19-DAG: call i32 @__tgt_target_teams_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00n]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00n]]{{.+}}, i8** null, i32 1, i32 0) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]] - - // CK19-USE: call void [[CALL00n:@.+]](i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL00n:@.+]]() - #pragma omp target map(alloc:b) - #pragma omp parallel - { -#ifdef USE - ++b; -#endif - } - - // Map of an array. - int arra[100]; - - // Region 01 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x i32]** - // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] - // CK19-DAG: store [100 x i32]* [[VAR0]], [100 x i32]** [[CP0]] - - // CK19-USE: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL01:@.+]]() - #pragma omp target map(to:arra) - { -#ifdef USE - arra[50]++; -#endif - } - - // Region 02 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 20 - - // CK19-USE: call void [[CALL02:@.+]]([100 x i32]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL02:@.+]]() - #pragma omp target map(from:arra[20:60]) - { -#ifdef USE - arra[50]++; -#endif - } - - // Region 03 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0 - - // CK19-USE: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL03:@.+]]() - #pragma omp target map(tofrom:arra[:60]) - { -#ifdef USE - arra[50]++; -#endif - } - - // Region 04 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0 - - // CK19-USE: call void [[CALL04:@.+]]([100 x i32]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL04:@.+]]() - #pragma omp target map(alloc:arra[:]) - { -#ifdef USE - arra[50]++; -#endif - } - - // Region 05 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 15 - - // CK19-USE: call void [[CALL05:@.+]]([100 x i32]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL05:@.+]]() - #pragma omp target map(to:arra[15]) - { -#ifdef USE - arra[15]++; -#endif - } - - // Region 06 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] - // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]] - // CK19-DAG: [[CSVAL0]] = {{mul nuw i.+ %.*, 4|sext i32 .+ to i64}} - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}} - - // CK19-USE: call void [[CALL06:@.+]]([100 x i32]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL06:@.+]]() - #pragma omp target map(tofrom:arra[ii:ii+23]) - { -#ifdef USE - arra[50]++; -#endif - } - - // Region 07 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] - // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]] - // CK19-DAG: [[CSVAL0]] = {{mul nuw i.+ %.*, 4|sext i32 .+ to i64}} - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0 - - // CK19-USE: call void [[CALL07:@.+]]([100 x i32]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL07:@.+]]() - #pragma omp target map(alloc:arra[:ii]) - { -#ifdef USE - arra[50]++; -#endif - } - - // Region 08 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}} - - // CK19-USE: call void [[CALL08:@.+]]([100 x i32]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL08:@.+]]() - #pragma omp target map(tofrom:arra[ii]) - { -#ifdef USE - arra[15]++; -#endif - } - - // Map of a pointer. - int *pa; - - // Region 09 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32*** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32*** - // CK19-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]] - // CK19-DAG: store i32** [[VAR0]], i32*** [[CP0]] - - // CK19-USE: call void [[CALL09:@.+]](i32** {{[^,]+}}) - // CK19-NOUSE: call void [[CALL09:@.+]]() - #pragma omp target map(from:pa) - { -#ifdef USE - pa[50]++; -#endif - } - - // Region 10 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 20 - // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] - - // CK19-USE: call void [[CALL10:@.+]](i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL10:@.+]]() - #pragma omp target map(tofrom:pa[20:60]) - { -#ifdef USE - pa[50]++; -#endif - } - - // Region 11 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0 - // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] - - // CK19-USE: call void [[CALL11:@.+]](i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL11:@.+]]() - #pragma omp target map(alloc:pa[:60]) - { -#ifdef USE - pa[50]++; -#endif - } - - // Region 12 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 15 - // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] - - // CK19-USE: call void [[CALL12:@.+]](i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL12:@.+]]() - #pragma omp target map(to:pa[15]) - { -#ifdef USE - pa[15]++; -#endif - } - - // Region 13 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]] - // CK19-DAG: [[CSVAL0]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} - // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}} - // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] - - // CK19-USE: call void [[CALL13:@.+]](i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL13:@.+]]() - #pragma omp target map(alloc:pa[ii-23:ii]) - { -#ifdef USE - pa[50]++; -#endif - } - - // Region 14 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]] - // CK19-DAG: [[CSVAL0]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} - // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0 - // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] - - // CK19-USE: call void [[CALL14:@.+]](i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL14:@.+]]() - #pragma omp target map(to:pa[:ii]) - { -#ifdef USE - pa[50]++; -#endif - } - - // Region 15 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE15]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE15]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}} - // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] - - // CK19-USE: call void [[CALL15:@.+]](i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL15:@.+]]() - #pragma omp target map(from:pa[ii+12]) - { -#ifdef USE - pa[15]++; -#endif - } - - // Map of a variable-size array. - int va[ii]; - - // Region 16 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|2}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[MTYPE16]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z:64|32]]* - // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]] - // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]] - // CK19-USE-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]] - - // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** - // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK19-USE-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] - // CK19-USE-DAG: store i32* [[VAR1]], i32** [[CP1]] - // CK19-USE-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]] - // CK19-USE-DAG: [[CSVAL1]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} - - // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-NOUSE-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK19-NOUSE-DAG: store i32* [[VAR0]], i32** [[CP0]] - // CK19-NOUSE-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]] - // CK19-NOUSE-DAG: [[CSVAL0]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} - - // CK19-USE: call void [[CALL16:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL16:@.+]]() - #pragma omp target map(to:va) - { -#ifdef USE - va[50]++; -#endif - } - - // Region 17 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|2}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[SIZE17]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[MTYPE17]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* - // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]] - // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]] - - // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** - // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK19-USE-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] - // CK19-USE-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] - // CK19-USE-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 20 - - // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-NOUSE-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK19-NOUSE-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[VAR0]], i{{.+}} 20 - - // CK19-USE: call void [[CALL17:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL17:@.+]]() - #pragma omp target map(from:va[20:60]) - { -#ifdef USE - va[50]++; -#endif - } - - // Region 18 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|2}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[SIZE18]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[MTYPE18]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* - // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]] - // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]] - - // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** - // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK19-USE-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] - // CK19-USE-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] - // CK19-USE-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0 - - // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-NOUSE-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK19-NOUSE-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[VAR0]], i{{.+}} 0 - - // CK19-USE: call void [[CALL18:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL18:@.+]]() - #pragma omp target map(tofrom:va[:60]) - { -#ifdef USE - va[50]++; -#endif - } - - // Region 19 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|2}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[MTYPE19]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* - // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]] - // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]] - // CK19-USE-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]] - - // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** - // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK19-USE-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] - // CK19-USE-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] - // CK19-USE-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]] - // CK19-USE-DAG: [[CSVAL1]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} - // CK19-USE-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0 - - // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-NOUSE-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK19-NOUSE-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK19-NOUSE-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]] - // CK19-NOUSE-DAG: [[CSVAL0]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} - // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[VAR0]], i{{.+}} 0 - - // CK19-USE: call void [[CALL19:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL19:@.+]]() - #pragma omp target map(alloc:va[:]) - { -#ifdef USE - va[50]++; -#endif - } - - // Region 20 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|2}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[SIZE20]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[MTYPE20]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* - // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]] - // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]] - - // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** - // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK19-USE-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] - // CK19-USE-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] - // CK19-USE-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 15 - - // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-NOUSE-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK19-NOUSE-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[VAR0]], i{{.+}} 15 - - // CK19-USE: call void [[CALL20:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL20:@.+]]() - #pragma omp target map(to:va[15]) - { -#ifdef USE - va[15]++; -#endif - } - - // Region 21 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|2}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[MTYPE21]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* - // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]] - // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]] - // CK19-USE-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]] - - // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** - // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK19-USE-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] - // CK19-USE-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] - // CK19-USE-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]] - // CK19-USE-DAG: [[CSVAL1]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} - // CK19-USE-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}} - - // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-NOUSE-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK19-NOUSE-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK19-NOUSE-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]] - // CK19-NOUSE-DAG: [[CSVAL0]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} - // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[VAR0]], i{{.+}} %{{.+}} - - // CK19-USE: call void [[CALL21:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL21:@.+]]() - #pragma omp target map(tofrom:va[ii:ii+23]) - { -#ifdef USE - va[50]++; -#endif - } - - // Region 22 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|2}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[SIZE22]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[MTYPE22]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* - // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]] - // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]] - - // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** - // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK19-USE-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] - // CK19-USE-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] - // CK19-USE-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}} - - // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-NOUSE-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK19-NOUSE-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[VAR0]], i{{.+}} %{{.+}} - - // CK19-USE: call void [[CALL22:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL22:@.+]]() - #pragma omp target map(tofrom:va[ii]) - { -#ifdef USE - va[15]++; -#endif - } - - // Always. - // Region 23 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE23]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE23]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]] - - // CK19-USE: call void [[CALL23:@.+]](i32* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL23:@.+]]() - #pragma omp target map(always, tofrom: a) - { -#ifdef USE - a++; -#endif - } - - // Multidimensional arrays. - int marr[4][5][6]; - int ***mptr; - - // Region 24 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE24]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE24]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [4 x [5 x [6 x i32]]]** - // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]] - // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0]], [4 x [5 x [6 x i32]]]** [[CP0]] - - // CK19-USE: call void [[CALL24:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL24:@.+]]() - #pragma omp target map(tofrom: marr) - { -#ifdef USE - marr[1][2][3]++; -#endif - } - - // Region 25 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE25]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE25]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 2 - // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2 - // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1 - - // CK19-USE: call void [[CALL25:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL25:@.+]]() - #pragma omp target map(tofrom: marr[1][2][2:4]) - { -#ifdef USE - marr[1][2][3]++; -#endif - } - - // Region 26 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE26]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE26]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2 - // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1 - - // CK19-USE: call void [[CALL26:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL26:@.+]]() - #pragma omp target map(tofrom: marr[1][2][:]) - { -#ifdef USE - marr[1][2][3]++; -#endif - } - - // Region 27 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE27]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE27]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 3 - // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2 - // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1 - - // CK19-USE: call void [[CALL27:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL27:@.+]]() - #pragma omp target map(tofrom: marr[1][2][3]) - { -#ifdef USE - marr[1][2][3]++; -#endif - } - - // Region 28 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE28]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE28]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**** - // CK19-DAG: store i32*** [[VAR0:%.+]], i32**** [[CBP0]] - // CK19-DAG: store i32*** [[SEC0:%.+]], i32**** [[CP0]] - // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]], - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1 - // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]], - - // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**** - // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32*** - // CK19-DAG: store i32*** [[SEC0]], i32**** [[CBP1]] - // CK19-DAG: store i32** [[SEC1:%.+]], i32*** [[CP1]] - // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2 - // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]], - // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1 - // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]], - - // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i32*** - // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** - // CK19-DAG: store i32** [[SEC1]], i32*** [[CBP2]] - // CK19-DAG: store i32* [[SEC2:%.+]], i32** [[CP2]] - // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 2 - // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]], - // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2 - // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]], - // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1 - // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]], - - // CK19-USE: call void [[CALL28:@.+]](i32*** {{[^,]+}}) - // CK19-NOUSE: call void [[CALL28:@.+]]() - #pragma omp target map(tofrom: mptr[1][2][2:4]) - { -#ifdef USE - mptr[1][2][3]++; -#endif - } - - // Region 29 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE29]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE29]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**** - // CK19-DAG: store i32*** [[VAR0:%.+]], i32**** [[CBP0]] - // CK19-DAG: store i32*** [[SEC0:%.+]], i32**** [[CP0]] - // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]], - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1 - // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]], - - // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**** - // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32*** - // CK19-DAG: store i32*** [[SEC0]], i32**** [[CBP1]] - // CK19-DAG: store i32** [[SEC1:%.+]], i32*** [[CP1]] - // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2 - // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]], - // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1 - // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]], - - // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i32*** - // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** - // CK19-DAG: store i32** [[SEC1]], i32*** [[CBP2]] - // CK19-DAG: store i32* [[SEC2:%.+]], i32** [[CP2]] - // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 3 - // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]], - // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2 - // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]], - // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1 - // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]], - - // CK19-USE: call void [[CALL29:@.+]](i32*** {{[^,]+}}) - // CK19-NOUSE: call void [[CALL29:@.+]]() - #pragma omp target map(tofrom: mptr[1][2][3]) - { -#ifdef USE - mptr[1][2][3]++; -#endif - } - - // Multidimensional VLA. - double mva[23][ii][ii+5]; - - // Region 30 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|4}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|4}} x i{{.+}}]* [[MTYPE30]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - // - // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* - // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] 23, i[[Z]]* [[CBP0]] - // CK19-USE-DAG: store i[[Z]] 23, i[[Z]]* [[CP0]] - // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S0]] - // - // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]* - // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]] - // CK19-USE-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]] - // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S1]] - // CK19-64-USE-DAG: [[VAR1]] = zext i32 %{{[^,]+}} to i64 - // CK19-64-USE-DAG: [[VAR11]] = zext i32 %{{[^,]+}} to i64 - // - // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i[[Z]]* - // CK19-USE-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] [[VAR2:%.+]], i[[Z]]* [[CBP2]] - // CK19-USE-DAG: store i[[Z]] [[VAR22:%.+]], i[[Z]]* [[CP2]] - // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S2]] - // CK19-64-USE-DAG: [[VAR2]] = zext i32 %{{[^,]+}} to i64 - // CK19-64-USE-DAG: [[VAR22]] = zext i32 %{{[^,]+}} to i64 - // - // CK19-USE-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3 - // CK19-USE-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3 - // CK19-USE-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3 - // CK19-USE-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double** - // CK19-USE-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double** - // CK19-USE-DAG: store double* [[VAR3:%.+]], double** [[CBP3]] - // CK19-USE-DAG: store double* [[VAR3]], double** [[CP3]] - // CK19-USE-DAG: store i64 [[CSVAL3:%[^,]+]], i64* [[S3]] - // CK19-USE-DAG: [[CSVAL3]] = {{mul nuw i64 %[^,]+, 8|sext i32 .+ to i64}} - - // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to double** - // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to double** - // CK19-NOUSE-DAG: store double* [[VAR0:%.+]], double** [[CBP0]] - // CK19-NOUSE-DAG: store double* [[VAR0]], double** [[CP0]] - // CK19-NOUSE-DAG: store i64 [[CSVAL0:%[^,]+]], i64* [[S0]] - // CK19-NOUSE-DAG: [[CSVAL0]] = {{mul nuw i64 %[^,]+, 8|sext i32 .+ to i64}} - - // CK19-USE: call void [[CALL30:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}}) - // CK19-NOUSE: call void [[CALL30:@.+]]() - #pragma omp target map(tofrom: mva) - { -#ifdef USE - mva[1][2][3]++; -#endif - } - - // Region 31 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|4}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[{{1|4}} x i{{.+}}]* [[SIZE31]], {{.+}}getelementptr {{.+}}[{{1|4}} x i{{.+}}]* [[MTYPE31]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // - // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* - // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] 23, i[[Z]]* [[CBP0]] - // CK19-USE-DAG: store i[[Z]] 23, i[[Z]]* [[CP0]] - // - // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]* - // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]] - // CK19-USE-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]] - // - // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i[[Z]]* - // CK19-USE-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] [[VAR2:%.+]], i[[Z]]* [[CBP2]] - // CK19-USE-DAG: store i[[Z]] [[VAR22:%.+]], i[[Z]]* [[CP2]] - // - // CK19-USE-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3 - // CK19-USE-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3 - // CK19-USE-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double** - // CK19-USE-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double** - // CK19-USE-DAG: store double* [[VAR3:%.+]], double** [[CBP3]] - // CK19-USE-DAG: store double* [[SEC3:%.+]], double** [[CP3]] - // CK19-USE-DAG: [[SEC3]] = getelementptr {{.*}}double* [[SEC33:%.+]], i[[Z]] 0 - // CK19-USE-DAG: [[SEC33]] = getelementptr {{.*}}double* [[SEC333:%.+]], i[[Z]] [[IDX3:%.+]] - // CK19-USE-DAG: [[IDX3]] = mul nsw i[[Z]] %{{[^,]+}}, %{{[^,]+}} - // CK19-USE-DAG: [[SEC333]] = getelementptr {{.*}}double* [[VAR3]], i[[Z]] [[IDX33:%.+]] - // CK19-USE-DAG: [[IDX33]] = mul nsw i[[Z]] 1, %{{[^,]+}} - - // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to double** - // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to double** - // CK19-NOUSE-DAG: store double* [[VAR0:%.+]], double** [[CBP0]] - // CK19-NOUSE-DAG: store double* [[SEC0:%.+]], double** [[CP0]] - // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.*}}double* [[SEC00:%.+]], i[[Z:64|32]] 0 - // CK19-NOUSE-DAG: [[SEC00]] = getelementptr {{.*}}double* [[SEC000:%.+]], i[[Z]] [[IDX0:%.+]] - // CK19-NOUSE-DAG: [[IDX0]] = mul nsw i[[Z]] %{{[^,]+}}, %{{[^,]+}} - // CK19-NOUSE-DAG: [[SEC000]] = getelementptr {{.*}}double* [[VAR0]], i[[Z]] [[IDX00:%.+]] - // CK19-NOUSE-DAG: [[IDX00]] = mul nsw i[[Z]] 1, %{{[^,]+}} - - // CK19-USE: call void [[CALL31:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}}) - // CK19-NOUSE: call void [[CALL31:@.+]]() - #pragma omp target map(tofrom: mva[1][ii-2][:5]) - { -#ifdef USE - mva[1][2][3]++; -#endif - } - - // Multidimensional array sections. - double marras[11][12][13]; - double mvlaas[11][ii][13]; - double ***mptras; - - // Region 32 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE32]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE32]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [11 x [12 x [13 x double]]]** - // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]] - // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0]], [11 x [12 x [13 x double]]]** [[CP0]] - - // CK19-USE: call void [[CALL32:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL32:@.+]]() - #pragma omp target map(marras) - { -#ifdef USE - marras[1][2][3]++; -#endif - } - - // Region 33 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE33]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE33]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [12 x [13 x double]]** - // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]] - // CK19-DAG: store [12 x [13 x double]]* [[SEC0:%.+]], [12 x [13 x double]]** [[CP0]] - // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0 - - // CK19-USE: call void [[CALL33:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL33:@.+]]() - #pragma omp target map(marras[:]) - { -#ifdef USE - marras[1][2][3]++; -#endif - } - - // Region 34 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE34]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE34]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [12 x [13 x double]]** - // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]] - // CK19-DAG: store [12 x [13 x double]]* [[SEC0:%.+]], [12 x [13 x double]]** [[CP0]] - // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0 - - // CK19-USE: call void [[CALL34:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL34:@.+]]() - #pragma omp target map(marras[:][:][:]) - { -#ifdef USE - marras[1][2][3]++; -#endif - } - - // Region 35 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE35]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - // - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** - // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]] - // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]] - // CK19-DAG: store i64 [[CSVAL0:%[^,]+]], i64* [[S0]] - // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0 - // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1 - // CK19-DAG: [[CSVAL0]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} - - // CK19-USE: call void [[CALL35:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL35:@.+]]() - #pragma omp target map(marras[1][:ii][:]) - { -#ifdef USE - marras[1][2][3]++; -#endif - } - - // Region 36 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE36]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE36]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** - // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]] - // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]] - // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[SEC00:%[^,]+]], i{{.+}} 0 - // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[SEC000]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0 - - // CK19-USE: call void [[CALL36:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL36:@.+]]() - #pragma omp target map(marras[:1][:2][:13]) - { -#ifdef USE - marras[1][2][3]++; -#endif - } - - // Region 37 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|3}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|3}} x i{{.+}}]* [[MTYPE37]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - // - // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* - // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]] - // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]] - // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S0]] - // - // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]* - // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]] - // CK19-USE-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]] - // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S1]] - // - // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]** - // CK19-USE-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]** - // CK19-USE-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]] - // CK19-USE-DAG: store [13 x double]* [[VAR2]], [13 x double]** [[CP2]] - // CK19-USE-DAG: store i64 [[CSVAL2:%[^,]+]], i64* [[S2]] - // CK19-USE-DAG: [[CSVAL2]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} - - // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [13 x double]** - // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** - // CK19-NOUSE-DAG: store [13 x double]* [[VAR0:%.+]], [13 x double]** [[CBP0]] - // CK19-NOUSE-DAG: store [13 x double]* [[VAR0]], [13 x double]** [[CP0]] - // CK19-NOUSE-DAG: store i64 [[CSVAL0:%[^,]+]], i64* [[S0]] - // CK19-NOUSE-DAG: [[CSVAL0]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} - - // CK19-USE: call void [[CALL37:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}}) - // CK19-NOUSE: call void [[CALL37:@.+]]() - #pragma omp target map(mvlaas) - { -#ifdef USE - mvlaas[1][2][3]++; -#endif - } - - // Region 38 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|3}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|3}} x i{{.+}}]* [[MTYPE38]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - // - // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* - // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]] - // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]] - // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S0]] - // - // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]* - // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]] - // CK19-USE-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]] - // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S1]] - // - // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]** - // CK19-USE-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]** - // CK19-USE-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]] - // CK19-USE-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]] - // CK19-USE-DAG: store i64 [[CSVAL2:%[^,]+]], i64* [[S2]] - // CK19-USE-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]] - // CK19-USE-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}} - // CK19-USE-DAG: [[CSVAL2]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} - - // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [13 x double]** - // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** - // CK19-NOUSE-DAG: store [13 x double]* [[VAR0:%.+]], [13 x double]** [[CBP0]] - // CK19-NOUSE-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]] - // CK19-NOUSE-DAG: store i64 [[CSVAL0:%[^,]+]], i64* [[S0]] - // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[VAR0]], i[[Z]] [[SEC00:%[^,]+]] - // CK19-NOUSE-DAG: [[SEC00]] = mul nsw i[[Z]] 0, %{{[^,]+}} - // CK19-NOUSE-DAG: [[CSVAL0]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} - - // CK19-USE: call void [[CALL38:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}}) - // CK19-NOUSE: call void [[CALL38:@.+]]() - #pragma omp target map(mvlaas[:]) - { -#ifdef USE - mvlaas[1][2][3]++; -#endif - } - - // Region 39 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|3}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|3}} x i{{.+}}]* [[MTYPE39]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - // - // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* - // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]] - // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]] - // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S0]] - // - // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]* - // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]] - // CK19-USE-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]] - // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S1]] - // - // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]** - // CK19-USE-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]** - // CK19-USE-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]] - // CK19-USE-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]] - // CK19-USE-DAG: store i64 [[CSVAL2:%[^,]+]], i64* [[S2]] - // CK19-USE-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]] - // CK19-USE-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}} - // CK19-USE-DAG: [[CSVAL2]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} - - // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [13 x double]** - // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** - // CK19-NOUSE-DAG: store [13 x double]* [[VAR0:%.+]], [13 x double]** [[CBP0]] - // CK19-NOUSE-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]] - // CK19-NOUSE-DAG: store i64 [[CSVAL0:%[^,]+]], i64* [[S0]] - // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[VAR0]], i[[Z]] [[SEC00:%[^,]+]] - // CK19-NOUSE-DAG: [[SEC00]] = mul nsw i[[Z]] 0, %{{[^,]+}} - // CK19-NOUSE-DAG: [[CSVAL0]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} - - // CK19-USE: call void [[CALL39:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}}) - // CK19-NOUSE: call void [[CALL39:@.+]]() - #pragma omp target map(mvlaas[:][:][:]) - { -#ifdef USE - mvlaas[1][2][3]++; -#endif - } - - // Region 40 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|3}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|3}} x i{{.+}}]* [[MTYPE40]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - // - // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* - // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]] - // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]] - // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S0]] - // - // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]* - // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]] - // CK19-USE-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]] - // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S1]] - // - // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]** - // CK19-USE-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]** - // CK19-USE-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]] - // CK19-USE-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]] - // CK19-USE-DAG: store i64 [[CSVAL2:%[^,]+]], i64* [[S2]] - // CK19-USE-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0 - // CK19-USE-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]] - // CK19-USE-DAG: [[SEC222]] = mul nsw i[[Z]] 1, %{{[^,]+}} - - // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [13 x double]** - // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** - // CK19-NOUSE-DAG: store [13 x double]* [[VAR0:%.+]], [13 x double]** [[CBP0]] - // CK19-NOUSE-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]] - // CK19-NOUSE-DAG: store i64 [[CSVAL0:%[^,]+]], i64* [[S0]] - // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[SEC00:%[^,]+]], i[[Z]] 0 - // CK19-NOUSE-DAG: [[SEC00]] = getelementptr {{.+}}[13 x double]* [[VAR0]], i[[Z]] [[SEC000:%[^,]+]] - // CK19-NOUSE-DAG: [[SEC000]] = mul nsw i[[Z]] 1, %{{[^,]+}} - - // CK19-USE: call void [[CALL40:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}}) - // CK19-NOUSE: call void [[CALL40:@.+]]() - #pragma omp target map(mvlaas[1][:ii][:]) - { -#ifdef USE - mvlaas[1][2][3]++; -#endif - } - - // Region 41 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|3}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[{{1|3}} x i{{.+}}]* [[SIZE41]], {{.+}}getelementptr {{.+}}[{{1|3}} x i{{.+}}]* [[MTYPE41]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // - // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* - // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]] - // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]] - // - // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]* - // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* - // CK19-USE-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]] - // CK19-USE-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]] - // - // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK19-USE-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]** - // CK19-USE-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]** - // CK19-USE-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]] - // CK19-USE-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]] - // CK19-USE-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0 - // CK19-USE-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]] - // CK19-USE-DAG: [[SEC222]] = mul nsw i[[Z]] 0, %{{[^,]+}} - // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - - // CK19-NO-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-NO-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [13 x double]** - // CK19-NO-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** - // CK19-NO-USE-DAG: store [13 x double]* [[VAR0:%.+]], [13 x double]** [[CBP0]] - // CK19-NO-USE-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]] - // CK19-NO-USE-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[SEC00:%[^,]+]], i[[Z]] 0 - // CK19-NO-USE-DAG: [[SEC00]] = getelementptr {{.+}}[13 x double]* [[VAR0]], i[[Z]] [[SEC000:%[^,]+]] - // CK19-NO-USE-DAG: [[SEC000]] = mul nsw i[[Z]] 0, %{{[^,]+}} - - // CK19-USE: call void [[CALL41:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}}) - // CK19-NOUSE: call void [[CALL41:@.+]]() - #pragma omp target map(mvlaas[:1][:2][:13]) - { -#ifdef USE - mvlaas[1][2][3]++; -#endif - } - - // Region 42 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE42]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE42]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to double**** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to double**** - // CK19-DAG: store double*** [[VAR0:%.+]], double**** [[CBP0]] - // CK19-DAG: store double*** [[SEC0:%.+]], double**** [[CP0]] - // CK19-DAG: [[VAR0]] = load double***, double**** [[PTR:%[^,]+]], - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}double*** [[SEC00:[^,]+]], i{{.+}} 0 - // CK19-DAG: [[SEC00]] = load double***, double**** [[PTR]], - - // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double**** - // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double*** - // CK19-DAG: store double*** [[SEC0]], double**** [[CBP1]] - // CK19-DAG: store double** [[SEC1:%.+]], double*** [[CP1]] - // CK19-DAG: [[SEC1]] = getelementptr {{.*}}double** [[SEC11:[^,]+]], i{{.+}} 2 - // CK19-DAG: [[SEC11]] = load double**, double*** [[SEC111:%[^,]+]], - // CK19-DAG: [[SEC111]] = getelementptr {{.*}}double*** [[SEC1111:[^,]+]], i{{.+}} 0 - // CK19-DAG: [[SEC1111]] = load double***, double**** [[PTR]], - - // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double*** - // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** - // CK19-DAG: store double** [[SEC1]], double*** [[CBP2]] - // CK19-DAG: store double* [[SEC2:%.+]], double** [[CP2]] - // CK19-DAG: [[SEC2]] = getelementptr {{.*}}double* [[SEC22:[^,]+]], i{{.+}} 0 - // CK19-DAG: [[SEC22]] = load double*, double** [[SEC222:%[^,]+]], - // CK19-DAG: [[SEC222]] = getelementptr {{.*}}double** [[SEC2222:[^,]+]], i{{.+}} 2 - // CK19-DAG: [[SEC2222]] = load double**, double*** [[SEC22222:%[^,]+]], - // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}double*** [[SEC222222:[^,]+]], i{{.+}} 0 - // CK19-DAG: [[SEC222222]] = load double***, double**** [[PTR]], - - // CK19-USE: call void [[CALL42:@.+]](double*** {{[^,]+}}) - // CK19-NOUSE: call void [[CALL42:@.+]]() - #pragma omp target map(mptras[:1][2][:13]) - { -#ifdef USE - mptras[1][2][3]++; -#endif - } - - // Region 43 - the memory is not contiguous for this map - will map the whole last dimension. - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE43]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - // - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** - // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]] - // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]] - // CK19-DAG: store i64 [[CSVAL0:%[^,]+]], i64* [[S0]] - // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0 - // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1 - // CK19-DAG: [[CSVAL0]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} - - // CK19-USE: call void [[CALL43:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL43:@.+]]() - #pragma omp target map(marras[1][:ii][1:]) - { -#ifdef USE - marras[1][2][3]++; -#endif - } - - // Region 44 - // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE44]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE44]]{{.+}}, i8** null) - // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** - // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] - // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] - // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 20 - - // CK19-USE: call void [[CALL44:@.+]]([100 x i32]* {{[^,]+}}) - // CK19-NOUSE: call void [[CALL44:@.+]]() - #pragma omp target map(from:arra[20:]) - { -#ifdef USE - arra[50]++; -#endif - } - -} - -// CK19: define {{.+}}[[CALL00]] -// CK19: define {{.+}}[[CALL01]] -// CK19: define {{.+}}[[CALL02]] -// CK19: define {{.+}}[[CALL03]] -// CK19: define {{.+}}[[CALL04]] -// CK19: define {{.+}}[[CALL05]] -// CK19: define {{.+}}[[CALL06]] -// CK19: define {{.+}}[[CALL07]] -// CK19: define {{.+}}[[CALL08]] -// CK19: define {{.+}}[[CALL09]] -// CK19: define {{.+}}[[CALL10]] -// CK19: define {{.+}}[[CALL11]] -// CK19: define {{.+}}[[CALL12]] -// CK19: define {{.+}}[[CALL13]] -// CK19: define {{.+}}[[CALL14]] -// CK19: define {{.+}}[[CALL15]] -// CK19: define {{.+}}[[CALL16]] -// CK19: define {{.+}}[[CALL17]] -// CK19: define {{.+}}[[CALL18]] -// CK19: define {{.+}}[[CALL19]] -// CK19: define {{.+}}[[CALL20]] -// CK19: define {{.+}}[[CALL21]] -// CK19: define {{.+}}[[CALL22]] -// CK19: define {{.+}}[[CALL23]] -// CK19: define {{.+}}[[CALL24]] -// CK19: define {{.+}}[[CALL25]] -// CK19: define {{.+}}[[CALL26]] -// CK19: define {{.+}}[[CALL27]] -// CK19: define {{.+}}[[CALL28]] -// CK19: define {{.+}}[[CALL29]] -// CK19: define {{.+}}[[CALL30]] -// CK19: define {{.+}}[[CALL31]] -// CK19: define {{.+}}[[CALL32]] -// CK19: define {{.+}}[[CALL33]] -// CK19: define {{.+}}[[CALL34]] -// CK19: define {{.+}}[[CALL35]] -// CK19: define {{.+}}[[CALL36]] -// CK19: define {{.+}}[[CALL37]] -// CK19: define {{.+}}[[CALL38]] -// CK19: define {{.+}}[[CALL39]] -// CK19: define {{.+}}[[CALL40]] -// CK19: define {{.+}}[[CALL41]] -// CK19: define {{.+}}[[CALL42]] -// CK19: define {{.+}}[[CALL43]] -// CK19: define {{.+}}[[CALL44]] - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64 -// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64 -// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32 -// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32 - -// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64 -// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64 -// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32 -// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32 - -// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64 -// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64 -// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32 -// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32 - -// RUN: %clang_cc1 -DCK20 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s -// RUN: %clang_cc1 -DCK20 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s -// RUN: %clang_cc1 -DCK20 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s -// RUN: %clang_cc1 -DCK20 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s -// SIMD-ONLY19-NOT: {{__kmpc|__tgt}} -#ifdef CK20 - -// CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK20: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK20: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 33] - -// CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK20: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 20] -// CK20: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 33] - -// CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK20: [[SIZE02:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK20: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 34] - -// CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK20: [[SIZE03:@.+]] = private {{.*}}constant [1 x i64] [i64 12] -// CK20: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 34] - -// CK20-LABEL: explicit_maps_references_and_function_args{{.*}}( -void explicit_maps_references_and_function_args (int a, float b, int (&c)[10], float *d){ - - int &aa = a; - float &bb = b; - int (&cc)[10] = c; - float *&dd = d; - - // Region 00 - // CK20-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) - // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK20-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] - // CK20-DAG: store i32* [[RVAR00:%.+]], i32** [[CP0]] - // CK20-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] - // CK20-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] - - // CK20: call void [[CALL00:@.+]](i32* {{[^,]+}}) - #pragma omp target map(to:aa) - { - aa += 1; - } - - // Region 01 - // CK20-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) - // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [10 x i32]** - // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK20-DAG: store [10 x i32]* [[RVAR0:%.+]], [10 x i32]** [[CBP0]] - // CK20-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK20-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[RVAR00:%.+]], i{{.+}} 0, i{{.+}} 0 - // CK20-DAG: [[RVAR0]] = load [10 x i32]*, [10 x i32]** [[VAR0:%[^,]+]] - // CK20-DAG: [[RVAR00]] = load [10 x i32]*, [10 x i32]** [[VAR0]] - - // CK20: call void [[CALL01:@.+]]([10 x i32]* {{[^,]+}}) - #pragma omp target map(to:cc[:5]) - { - cc[3] += 1; - } - - // Region 02 - // CK20-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) - // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float** - // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float** - // CK20-DAG: store float* [[VAR0:%.+]], float** [[CBP0]] - // CK20-DAG: store float* [[VAR0]], float** [[CP0]] - - // CK20: call void [[CALL02:@.+]](float* {{[^,]+}}) - #pragma omp target map(from:b) - { - b += 1.0f; - } - - // Region 03 - // CK20-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}}, i8** null) - // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float** - // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float** - // CK20-DAG: store float* [[RVAR0:%.+]], float** [[CBP0]] - // CK20-DAG: store float* [[SEC0:%.+]], float** [[CP0]] - // CK20-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]] - // CK20-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2 - // CK20-DAG: [[RVAR00]] = load float*, float** [[VAR0]] - - // CK20: call void [[CALL03:@.+]](float* {{[^,]+}}) - #pragma omp target map(from:d[2:3]) - { - d[2] += 1.0f; - } -} - -// CK20: define {{.+}}[[CALL00]] -// CK20: define {{.+}}[[CALL01]] -// CK20: define {{.+}}[[CALL02]] -// CK20: define {{.+}}[[CALL03]] - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-USE -// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-USE -// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-USE -// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-USE - -// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-USE -// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-USE -// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-USE -// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-USE - -// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-USE -// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-USE -// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-USE -// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-USE - -// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s -// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s -// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s -// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s - -// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-NOUSE -// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-NOUSE -// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-NOUSE -// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-NOUSE - -// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-NOUSE -// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-NOUSE -// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-NOUSE -// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-NOUSE - -// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-NOUSE -// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-NOUSE -// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-NOUSE -// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-NOUSE - -// RUN: %clang_cc1 -DCK21 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s -// RUN: %clang_cc1 -DCK21 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s -// RUN: %clang_cc1 -DCK21 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s -// RUN: %clang_cc1 -DCK21 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s - -// SIMD-ONLY20-NOT: {{__kmpc|__tgt}} -#ifdef CK21 -// CK21: [[ST:%.+]] = type { i32, i32, float* } - -// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK21: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] - -// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK21: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 492] -// CK21: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK21: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710674] - -// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK21: [[SIZE03:@.+]] = private {{.*}}constant [1 x i64] [i64 492] -// CK21: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 34] - -// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK21: [[SIZE04:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK21: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 34] - -// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK21: [[MTYPE05:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710659, i64 281474976710659] - -// CK21-LABEL: explicit_maps_template_args_and_members{{.*}}( - -template -struct CC { - T A; - int A2; - float *B; - - int foo(T arg) { - float la[X]; - T *lb; - - // Region 00 - // CK21-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) - // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK21-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK21-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** - // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] - // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK21-DAG: store i64 {{%.+}}, i64* [[S0]] - // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0 - - // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK21-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** - // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK21-DAG: store [[ST]]* [[VAR1:%.+]], [[ST]]** [[CBP1]] - // CK21-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] - // CK21-DAG: store i64 {{.+}}, i64* [[S1]] - // CK21-DAG: [[SEC1]] = getelementptr {{.*}}[[ST]]* [[VAR1:%.+]], i{{.+}} 0, i{{.+}} 0 - - // CK21-USE: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}}) - // CK21-NOUSE: call void [[CALL00:@.+]]() - #pragma omp target map(A) - { -#ifdef USE - A += 1; -#endif - } - - // Region 01 - // CK21-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) - // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK21-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] - // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK21-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] - // CK21-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0 - // CK21-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] - - // CK21-USE: call void [[CALL01:@.+]](i32* {{[^,]+}}) - // CK21-NOUSE: call void [[CALL01:@.+]]() - #pragma omp target map(lb[:X]) - { -#ifdef USE - lb[4] += 1; -#endif - } - - // Region 02 - // CK21-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) - // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK21-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK21-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** - // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float*** - // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] - // CK21-DAG: store float** [[SEC0:%.+]], float*** [[CP0]] - // CK21-DAG: store i64 {{%.+}}, i64* [[S0]] - // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2 - - // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK21-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float*** - // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float** - // CK21-DAG: store float** [[SEC0]], float*** [[CBP1]] - // CK21-DAG: store float* [[SEC1:%.+]], float** [[CP1]] - // CK21-DAG: store i64 {{.+}}, i64* [[S1]] - // CK21-DAG: [[SEC1]] = getelementptr {{.*}}float* [[RVAR1:%[^,]+]], i{{.+}} 123 - // CK21-DAG: [[RVAR1]] = load float*, float** [[SEC1_:%[^,]+]] - // CK21-DAG: [[SEC1_]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2 - - // CK21-USE: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}}) - // CK21-NOUSE: call void [[CALL02:@.+]]() - #pragma omp target map(from:B[X:X+2]) - { -#ifdef USE - B[2] += 1.0f; -#endif - } - - // Region 03 - // CK21-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}}, i8** null) - // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [123 x float]** - // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [123 x float]** - // CK21-DAG: store [123 x float]* [[VAR0:%.+]], [123 x float]** [[CBP0]] - // CK21-DAG: store [123 x float]* [[VAR0]], [123 x float]** [[CP0]] - - // CK21-USE: call void [[CALL03:@.+]]([123 x float]* {{[^,]+}}) - // CK21-NOUSE: call void [[CALL03:@.+]]() - #pragma omp target map(from:la) - { -#ifdef USE - la[3] += 1.0f; -#endif - } - - // Region 04 - // CK21-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}}, i8** null) - // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK21-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK21-DAG: store i32* [[VAR0]], i32** [[CP0]] - - // CK21-USE: call void [[CALL04:@.+]](i32* {{[^,]+}}) - // CK21-NOUSE: call void [[CALL04:@.+]]() - #pragma omp target map(from:arg) - { -#ifdef USE - arg +=1; -#endif - } - - // Make sure the extra flag is passed to the second map. - // Region 05 - // CK21-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE05]]{{.+}}, i8** null) - // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK21-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK21-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** - // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] - // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK21-DAG: store i64 {{%.+}}, i64* [[S0]] - // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0 - - // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK21-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** - // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK21-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CBP1]] - // CK21-DAG: store i32* [[SEC0]], i32** [[CP1]] - // CK21-DAG: store i64 {{.+}}, i64* [[S1]] - - // CK21-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK21-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK21-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 - // CK21-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]** - // CK21-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** - // CK21-DAG: store [[ST]]* [[VAR2:%.+]], [[ST]]** [[CBP2]] - // CK21-DAG: store i32* [[SEC2:%.+]], i32** [[CP2]] - // CK21-DAG: store i64 {{.+}}, i64* [[S2]] - // CK21-DAG: [[SEC2]] = getelementptr {{.*}}[[ST]]* [[VAR2]], i{{.+}} 0, i{{.+}} 1 - - // CK21-USE: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}}) - // CK21-NOUSE: call void [[CALL05:@.+]]() - #pragma omp target map(A, A2) - { -#ifdef USE - A += 1; - A2 += 1; -#endif - } - return A; - } -}; - -int explicit_maps_template_args_and_members(int a){ - CC<123,int> c; - return c.foo(a); -} - -// CK21: define {{.+}}[[CALL00]] -// CK21: define {{.+}}[[CALL01]] -// CK21: define {{.+}}[[CALL02]] -// CK21: define {{.+}}[[CALL03]] -// CK21: define {{.+}}[[CALL04]] -// CK21: define {{.+}}[[CALL05]] -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-64 -// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-64 -// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-32 -// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-32 - -// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-64 -// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-64 -// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-32 -// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-32 - -// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-64 -// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-64 -// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-32 -// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-32 - -// RUN: %clang_cc1 -DCK22 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY21 %s -// RUN: %clang_cc1 -DCK22 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY21 %s -// RUN: %clang_cc1 -DCK22 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY21 %s -// RUN: %clang_cc1 -DCK22 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY21 %s -// SIMD-ONLY21-NOT: {{__kmpc|__tgt}} -#ifdef CK22 - -// CK22-DAG: [[ST:%.+]] = type { float } -// CK22-DAG: [[STT:%.+]] = type { i32 } - -// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK22: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK22: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK22: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 400] -// CK22: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK22: [[SIZE02:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] -// CK22: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK22: [[SIZE03:@.+]] = private {{.*}}constant [1 x i64] [i64 16] -// CK22: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK22: [[SIZE04:@.+]] = private {{.*}}constant [1 x i64] [i64 20] -// CK22: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 51] - -// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK22: [[SIZE05:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK22: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK22: [[SIZE06:@.+]] = private {{.*}}constant [1 x i64] [i64 400] -// CK22: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK22: [[SIZE07:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] -// CK22: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK22: [[SIZE08:@.+]] = private {{.*}}constant [1 x i64] [i64 16] -// CK22: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK22: [[SIZE09:@.+]] = private {{.*}}constant [1 x i64] [i64 20] -// CK22: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 51] - -// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK22: [[SIZE10:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK22: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK22: [[SIZE11:@.+]] = private {{.*}}constant [1 x i64] [i64 400] -// CK22: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK22: [[SIZE12:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] -// CK22: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK22: [[SIZE13:@.+]] = private {{.*}}constant [1 x i64] [i64 16] -// CK22: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK22: [[SIZE14:@.+]] = private {{.*}}constant [1 x i64] [i64 20] -// CK22: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i64] [i64 51] - -int a; -int c[100]; -int *d; - -struct ST { - float fa; -}; - -ST sa ; -ST sc[100]; -ST *sd; - -template -struct STT { - T fa; -}; - -STT sta ; -STT stc[100]; -STT *std; - -// CK22-LABEL: explicit_maps_globals{{.*}}( -int explicit_maps_globals(void){ - // Region 00 - // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) - // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK22-DAG: store i32* @a, i32** [[CBP0]] - // CK22-DAG: store i32* @a, i32** [[CP0]] - - // CK22: call void [[CALL00:@.+]](i32* {{[^,]+}}) - #pragma omp target map(a) - { a+=1; } - - // Region 01 - // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) - // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** - // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x i32]** - // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CBP0]] - // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CP0]] - - // CK22: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}}) - #pragma omp target map(c) - { c[3]+=1; } - - // Region 02 - // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) - // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32*** - // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32*** - // CK22-DAG: store i32** @d, i32*** [[CBP0]] - // CK22-DAG: store i32** @d, i32*** [[CP0]] - - // CK22: call void [[CALL02:@.+]](i32** {{[^,]+}}) - #pragma omp target map(d) - { d[3]+=1; } - - // Region 03 - // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}}, i8** null) - // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** - // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CBP0]] - // CK22-DAG: store i32* getelementptr inbounds ([100 x i32], [100 x i32]* @c, i{{.+}} 0, i{{.+}} 1), i32** [[CP0]] - - // CK22: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}}) - #pragma omp target map(c[1:4]) - { c[3]+=1; } - - // Region 04 - // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}}, i8** null) - // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32*** - // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK22-DAG: store i32** @d, i32*** [[CBP0]] - // CK22-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK22-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 2 - // CK22-DAG: [[RVAR00]] = load i32*, i32** @d - - // CK22: call void [[CALL04:@.+]](i32* {{[^,]+}}) - #pragma omp target map(d[2:5]) - { d[3]+=1; } - - // Region 05 - // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}}, i8** null) - // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** - // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]** - // CK22-DAG: store [[ST]]* @sa, [[ST]]** [[CBP0]] - // CK22-DAG: store [[ST]]* @sa, [[ST]]** [[CP0]] - - // CK22: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}}) - #pragma omp target map(sa) - { sa.fa+=1; } - - // Region 06 - // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE06]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}}, i8** null) - // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[ST]]]** - // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x [[ST]]]** - // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CBP0]] - // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CP0]] - - // CK22: call void [[CALL06:@.+]]([100 x [[ST]]]* {{[^,]+}}) - #pragma omp target map(sc) - { sc[3].fa+=1; } - - // Region 07 - // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE07]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}}, i8** null) - // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]*** - // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]*** - // CK22-DAG: store [[ST]]** @sd, [[ST]]*** [[CBP0]] - // CK22-DAG: store [[ST]]** @sd, [[ST]]*** [[CP0]] - - // CK22: call void [[CALL07:@.+]]([[ST]]** {{[^,]+}}) - #pragma omp target map(sd) - { sd[3].fa+=1; } - - // Region 08 - // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}}, i8** null) - // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[ST]]]** - // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]** - // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CBP0]] - // CK22-DAG: store [[ST]]* getelementptr inbounds ([100 x [[ST]]], [100 x [[ST]]]* @sc, i{{.+}} 0, i{{.+}} 1), [[ST]]** [[CP0]] - - // CK22: call void [[CALL08:@.+]]([100 x [[ST]]]* {{[^,]+}}) - #pragma omp target map(sc[1:4]) - { sc[3].fa+=1; } - - // Region 09 - // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}}, i8** null) - // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]*** - // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]** - // CK22-DAG: store [[ST]]** @sd, [[ST]]*** [[CBP0]] - // CK22-DAG: store [[ST]]* [[SEC0:%.+]], [[ST]]** [[CP0]] - // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[RVAR00:%.+]], i{{.+}} 2 - // CK22-DAG: [[RVAR00]] = load [[ST]]*, [[ST]]** @sd - - // CK22: call void [[CALL09:@.+]]([[ST]]* {{[^,]+}}) - #pragma omp target map(sd[2:5]) - { sd[3].fa+=1; } - - // Region 10 - // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}}, i8** null) - // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]** - // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]** - // CK22-DAG: store [[STT]]* @sta, [[STT]]** [[CBP0]] - // CK22-DAG: store [[STT]]* @sta, [[STT]]** [[CP0]] - - // CK22: call void [[CALL10:@.+]]([[STT]]* {{[^,]+}}) - #pragma omp target map(sta) - { sta.fa+=1; } - - // Region 11 - // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}}, i8** null) - // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[STT]]]** - // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x [[STT]]]** - // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CBP0]] - // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CP0]] - - // CK22: call void [[CALL11:@.+]]([100 x [[STT]]]* {{[^,]+}}) - #pragma omp target map(stc) - { stc[3].fa+=1; } - - // Region 12 - // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}}, i8** null) - // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]*** - // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]*** - // CK22-DAG: store [[STT]]** @std, [[STT]]*** [[CBP0]] - // CK22-DAG: store [[STT]]** @std, [[STT]]*** [[CP0]] - - // CK22: call void [[CALL12:@.+]]([[STT]]** {{[^,]+}}) - #pragma omp target map(std) - { std[3].fa+=1; } - - // Region 13 - // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE13]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}}, i8** null) - // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[STT]]]** - // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]** - // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CBP0]] - // CK22-DAG: store [[STT]]* getelementptr inbounds ([100 x [[STT]]], [100 x [[STT]]]* @stc, i{{.+}} 0, i{{.+}} 1), [[STT]]** [[CP0]] - - // CK22: call void [[CALL13:@.+]]([100 x [[STT]]]* {{[^,]+}}) - #pragma omp target map(stc[1:4]) - { stc[3].fa+=1; } - - // Region 14 - // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE14]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}}, i8** null) - // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]*** - // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]** - // CK22-DAG: store [[STT]]** @std, [[STT]]*** [[CBP0]] - // CK22-DAG: store [[STT]]* [[SEC0:%.+]], [[STT]]** [[CP0]] - // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[STT]]* [[RVAR00:%.+]], i{{.+}} 2 - // CK22-DAG: [[RVAR00]] = load [[STT]]*, [[STT]]** @std - - // CK22: call void [[CALL14:@.+]]([[STT]]* {{[^,]+}}) - #pragma omp target map(std[2:5]) - { std[3].fa+=1; } - - return 0; -} -// CK22: define {{.+}}[[CALL00]] -// CK22: define {{.+}}[[CALL01]] -// CK22: define {{.+}}[[CALL02]] -// CK22: define {{.+}}[[CALL03]] -// CK22: define {{.+}}[[CALL04]] -// CK22: define {{.+}}[[CALL05]] -// CK22: define {{.+}}[[CALL06]] -// CK22: define {{.+}}[[CALL07]] -// CK22: define {{.+}}[[CALL08]] -// CK22: define {{.+}}[[CALL09]] -// CK22: define {{.+}}[[CALL10]] -// CK22: define {{.+}}[[CALL11]] -// CK22: define {{.+}}[[CALL12]] -// CK22: define {{.+}}[[CALL13]] -// CK22: define {{.+}}[[CALL14]] -#endif -///==========================================================================/// -// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-64 -// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-64 -// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-32 -// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-32 - -// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-64 -// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-64 -// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-32 -// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-32 - -// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-64 -// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-64 -// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-32 -// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-32 - -// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY22 %s -// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -std=c++11 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY22 %s -// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY22 %s -// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -std=c++11 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY22 %s -// SIMD-ONLY22-NOT: {{__kmpc|__tgt}} -#ifdef CK23 - -// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK23: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK23: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK23: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK23: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK23: [[SIZE02:@.+]] = private {{.*}}constant [1 x i64] [i64 400] -// CK23: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK23: [[SIZE03:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] -// CK23: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK23: [[SIZE04:@.+]] = private {{.*}}constant [1 x i64] [i64 16] -// CK23: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK23: [[SIZE05:@.+]] = private {{.*}}constant [1 x i64] [i64 16] -// CK23: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK23-LABEL: explicit_maps_inside_captured{{.*}}( -int explicit_maps_inside_captured(int a){ - float b; - float c[100]; - float *d; - - // CK23: call void @{{.*}}explicit_maps_inside_captured{{.*}}([[SA:%.+]]* {{.*}}) - // CK23: define {{.*}}explicit_maps_inside_captured{{.*}} - [&](void){ - // Region 00 - // CK23-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) - // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK23-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK23-DAG: store i32* [[VAR00:%.+]], i32** [[CP0]] - // CK23-DAG: [[VAR0]] = load i32*, i32** [[CAP0:%[^,]+]] - // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]] - // CK23-DAG: [[VAR00]] = load i32*, i32** [[CAP00:%[^,]+]] - // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]] - - // CK23: call void [[CALL00:@.+]](i32* {{[^,]+}}) - #pragma omp target map(a) - { a+=1; } - // Region 01 - // CK23-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) - // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float** - // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float** - // CK23-DAG: store float* [[VAR0:%.+]], float** [[CBP0]] - // CK23-DAG: store float* [[VAR00:%.+]], float** [[CP0]] - // CK23-DAG: [[VAR0]] = load float*, float** [[CAP0:%[^,]+]] - // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]] - // CK23-DAG: [[VAR00]] = load float*, float** [[CAP00:%[^,]+]] - // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]] - - // CK23: call void [[CALL01:@.+]](float* {{[^,]+}}) - #pragma omp target map(b) - { b+=1; } - // Region 02 - // CK23-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) - // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x float]** - // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x float]** - // CK23-DAG: store [100 x float]* [[VAR0:%.+]], [100 x float]** [[CBP0]] - // CK23-DAG: store [100 x float]* [[VAR00:%.+]], [100 x float]** [[CP0]] - // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]] - // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]] - // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]] - // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]] - - // CK23: call void [[CALL02:@.+]]([100 x float]* {{[^,]+}}) - #pragma omp target map(c) - { c[3]+=1; } - - // Region 03 - // CK23-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}}, i8** null) - // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float*** - // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float*** - // CK23-DAG: store float** [[VAR0:%.+]], float*** [[CBP0]] - // CK23-DAG: store float** [[VAR00:%.+]], float*** [[CP0]] - // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]] - // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]] - // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]] - // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]] - - // CK23: call void [[CALL03:@.+]](float** {{[^,]+}}) - #pragma omp target map(d) - { d[3]+=1; } - // Region 04 - // CK23-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}}, i8** null) - // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x float]** - // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float** - // CK23-DAG: store [100 x float]* [[VAR0:%.+]], [100 x float]** [[CBP0]] - // CK23-DAG: store float* [[SEC0:%.+]], float** [[CP0]] - // CK23-DAG: [[SEC0]] = getelementptr {{.*}}[100 x float]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2 - // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]] - // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]] - // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]] - // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]] - - // CK23: call void [[CALL04:@.+]]([100 x float]* {{[^,]+}}) - #pragma omp target map(c[2:4]) - { c[3]+=1; } - - // Region 05 - // CK23-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}}, i8** null) - // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float** - // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float** - // CK23-DAG: store float* [[RVAR0:%.+]], float** [[CBP0]] - // CK23-DAG: store float* [[SEC0:%.+]], float** [[CP0]] - // CK23-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]] - // CK23-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2 - // CK23-DAG: [[RVAR00]] = load float*, float** [[VAR00:%[^,]+]] - // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]] - // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]] - // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]] - // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]] - - // CK23: call void [[CALL05:@.+]](float* {{[^,]+}}) - #pragma omp target map(d[2:4]) - { d[3]+=1; } - }(); - return b; -} - -// CK23: define {{.+}}[[CALL00]] -// CK23: define {{.+}}[[CALL01]] -// CK23: define {{.+}}[[CALL02]] -// CK23: define {{.+}}[[CALL03]] -// CK23: define {{.+}}[[CALL04]] -// CK23: define {{.+}}[[CALL05]] -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64 -// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64 -// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32 -// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32 - -// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64 -// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64 -// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32 -// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32 - -// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64 -// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64 -// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32 -// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32 - -// RUN: %clang_cc1 -DCK24 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY23 %s -// RUN: %clang_cc1 -DCK24 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY23 %s -// RUN: %clang_cc1 -DCK24 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY23 %s -// RUN: %clang_cc1 -DCK24 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY23 %s -// SIMD-ONLY23-NOT: {{__kmpc|__tgt}} -#ifdef CK24 - -// CK24-DAG: [[SC:%.+]] = type { i32, [[SB:%.+]], [[SB:%.+]]*, [10 x i32] } -// CK24-DAG: [[SB]] = type { i32, [[SA:%.+]], [10 x [[SA:%.+]]], [10 x [[SA:%.+]]*], [[SA:%.+]]* } -// CK24-DAG: [[SA]] = type { i32, [[SA]]*, [10 x i32] } - -struct SA{ - int a; - struct SA *p; - int b[10]; -}; -struct SB{ - int a; - struct SA s; - struct SA sa[10]; - struct SA *sp[10]; - struct SA *p; -}; -struct SC{ - int a; - struct SB s; - struct SB *p; - int b[10]; -}; - -// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK24: [[MTYPE01:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] - -// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK24: [[MTYPE13:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] - -// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK24: [[MTYPE14:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] - -// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK24: [[MTYPE15:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] - -// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK24: [[MTYPE16:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] - -// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK24: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710675] - -// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK24: [[MTYPE18:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] - -// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK24: [[MTYPE19:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710659, i64 281474976710675] - -// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK24: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710675] - -// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK24: [[MTYPE21:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710659, i64 281474976710675] - -// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK24: [[MTYPE22:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] - -// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK24: [[MTYPE23:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710659, i64 281474976710675] - -// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK24: [[MTYPE24:@.+]] = private {{.*}}constant [4 x i64] [i64 32, i64 281474976710672, i64 16, i64 19] - -// CK24-LABEL: explicit_maps_struct_fields -int explicit_maps_struct_fields(int a){ - SC s; - SC *p; - -// Region 01 -// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) -// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] -// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] -// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - -// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** -// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** -// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] -// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] -// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] -// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0 - -// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** -// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** -// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] -// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]] -// CK24-DAG: store i64 {{.+}}, i64* [[S1]] - -// CK24: call void [[CALL01:@.+]]([[SC]]* {{[^,]+}}) -#pragma omp target map(s.a) - { s.a++; } - -// -// Same thing but starting from a pointer. -// -// Region 13 -// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE13]]{{.+}}, i8** null) -// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] -// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] -// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - -// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** -// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** -// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] -// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] -// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] -// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 0 - -// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** -// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** -// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] -// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]] -// CK24-DAG: store i64 {{.+}}, i64* [[S1]] - -// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} - -// CK24: call void [[CALL13:@.+]]([[SC]]* {{[^,]+}}) -#pragma omp target map(p->a) - { p->a++; } - -// Region 14 -// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE14]]{{.+}}, i8** null) -// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] -// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] -// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - -// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** -// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]** -// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] -// CK24-DAG: store [[SA]]* [[SEC0:%.+]], [[SA]]** [[CP0]] -// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] -// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1 - -// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** -// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]** -// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] -// CK24-DAG: store [[SA]]* [[SEC0]], [[SA]]** [[CP1]] -// CK24-DAG: store i64 {{.+}}, i64* [[S1]] - -// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} - -// CK24: call void [[CALL14:@.+]]([[SC]]* {{[^,]+}}) -#pragma omp target map(p->s.s) - { p->a++; } - -// Region 15 -// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE15]]{{.+}}, i8** null) -// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] -// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] -// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - -// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** -// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** -// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] -// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] -// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] -// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1 - -// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** -// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** -// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] -// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]] -// CK24-DAG: store i64 {{.+}}, i64* [[S1]] - -// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} - -// CK24: call void [[CALL15:@.+]]([[SC]]* {{[^,]+}}) -#pragma omp target map(p->s.s.a) - { p->a++; } - -// Region 16 -// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE16]]{{.+}}, i8** null) -// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] -// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] -// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - -// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** -// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** -// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] -// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] -// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] -// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 3 - -// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** -// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** -// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] -// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]] -// CK24-DAG: store i64 {{.+}}, i64* [[S1]] - -// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} - -// CK24: call void [[CALL16:@.+]]([[SC]]* {{[^,]+}}) -#pragma omp target map(p->b[:5]) - { p->a++; } - -// Region 17 -// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE17]]{{.+}}, i8** null) -// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] -// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] -// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - -// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** -// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]*** -// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] -// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]] -// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] -// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2 - -// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]*** -// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SB]]** -// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]] -// CK24-DAG: store [[SB]]* [[SEC1:%.+]], [[SB]]** [[CP1]] -// CK24-DAG: store i64 {{.+}}, i64* [[S1]] -// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0 -// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]], -// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2 - -// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}} - -// CK24: call void [[CALL17:@.+]]([[SC]]* {{[^,]+}}) -#pragma omp target map(p->p[:5]) - { p->a++; } - -// Region 18 -// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE18]]{{.+}}, i8** null) -// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] -// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] -// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - -// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** -// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** -// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] -// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] -// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] -// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[10 x [[SA]]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3 -// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 2 -// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1 - -// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** -// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** -// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] -// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]] -// CK24-DAG: store i64 {{.+}}, i64* [[S1]] - -// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} - -// CK24: call void [[CALL18:@.+]]([[SC]]* {{[^,]+}}) -#pragma omp target map(p->s.sa[3].a) - { p->a++; } - -// Region 19 -// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE19]]{{.+}}, i8** null) -// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] -// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] -// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - -// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** -// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]*** -// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] -// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]] -// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] -// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 3 -// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3 -// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1 - -// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** -// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]*** -// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] -// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CP1]] -// CK24-DAG: store i64 {{.+}}, i64* [[S1]] - -// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 -// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 -// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]*** -// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** -// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP2]] -// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP2]] -// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]], -// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC1111:%[^,]+]], i{{.+}} 0, i{{.+}} 3 -// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 3 -// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1 - -// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}} - -// CK24: call void [[CALL19:@.+]]([[SC]]* {{[^,]+}}) -#pragma omp target map(p->s.sp[3]->a) - { p->a++; } - -// Region 20 -// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE20]]{{.+}}, i8** null) -// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] -// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] -// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - -// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** -// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]*** -// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] -// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]] -// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] -// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2 - -// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]*** -// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** -// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]] -// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] -// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0 -// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]], -// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2 - -// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}} - -// CK24: call void [[CALL20:@.+]]([[SC]]* {{[^,]+}}) -#pragma omp target map(p->p->a) - { p->a++; } - -// Region 21 -// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE21]]{{.+}}, i8** null) -// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] -// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] -// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - -// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** -// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]*** -// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] -// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]] -// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] -// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 4 -// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1 - -// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** -// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]*** -// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] -// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CP1]] -// CK24-DAG: store i64 {{.+}}, i64* [[S1]] - -// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 -// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 -// CK24-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 -// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]*** -// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** -// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP2]] -// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP2]] -// CK24-DAG: store i64 {{.+}}, i64* [[S2]] -// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0 -// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]], -// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SB]]* [[SEC1111:[^,]+]], i{{.+}} 0, i{{.+}} 4 -// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1 - -// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}} - -// CK24: call void [[CALL21:@.+]]([[SC]]* {{[^,]+}}) -#pragma omp target map(p->s.p->a) - { p->a++; } - -// Region 22 -// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE22]]{{.+}}, i8** null) -// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] -// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] -// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - -// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** -// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** -// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] -// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] -// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] -// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SA]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 2 -// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1 - -// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** -// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** -// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] -// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]] -// CK24-DAG: store i64 {{.+}}, i64* [[S1]] - -// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} - -// CK24: call void [[CALL22:@.+]]([[SC]]* {{[^,]+}}) -#pragma omp target map(p->s.s.b[:2]) - { p->a++; } - -// Region 23 -// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE23]]{{.+}}, i8** null) -// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] -// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] -// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - -// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** -// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]*** -// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] -// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]] -// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] -// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 4 -// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1 - -// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** -// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]*** -// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] -// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CP1]] -// CK24-DAG: store i64 {{.+}}, i64* [[S1]] - -// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 -// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 -// CK24-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 -// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]*** -// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** -// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP2]] -// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP2]] -// CK24-DAG: store i64 {{.+}}, i64* [[S2]] -// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[10 x i32]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[SEC11]] = getelementptr {{.*}}[[SA]]* [[SEC111:%[^,]+]], i{{.+}} 0, i{{.+}} 2 -// CK24-DAG: [[SEC111]] = load [[SA]]*, [[SA]]** [[SEC1111:%[^,]+]], -// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 4 -// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1 - -// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}} - -// CK24: call void [[CALL23:@.+]]([[SC]]* {{[^,]+}}) -#pragma omp target map(p->s.p->b[:2]) - { p->a++; } - -// Region 24 -// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE24]]{{.+}}, i8** null) -// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] -// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] -// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - -// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** -// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]*** -// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] -// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]] -// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] -// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2 - -// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]*** -// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]*** -// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]] -// CK24-DAG: store [[SA]]** [[SEC1:%.+]], [[SA]]*** [[CP1]] -// CK24-DAG: store i64 {{.+}}, i64* [[S1]] -// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 4 -// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]], -// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2 - -// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 -// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 -// CK24-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 -// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]*** -// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [[SA]]*** -// CK24-DAG: store [[SA]]** [[SEC1]], [[SA]]*** [[CBP2]] -// CK24-DAG: store [[SA]]** [[SEC2:%.+]], [[SA]]*** [[CP2]] -// CK24-DAG: store i64 {{.+}}, i64* [[S2]] -// CK24-DAG: [[SEC2]] = getelementptr {{.*}}[[SA]]* [[SEC22:%[^,]+]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[SEC22]] = load [[SA]]*, [[SA]]** [[SEC222:%[^,]+]], -// CK24-DAG: [[SEC222]] = getelementptr {{.*}}[[SB]]* [[SEC2222:%[^,]+]], i{{.+}} 0, i{{.+}} 4 -// CK24-DAG: [[SEC2222]] = load [[SB]]*, [[SB]]** [[SEC22222:%[^,]+]], -// CK24-DAG: [[SEC22222]] = getelementptr {{.*}}[[SC]]* [[VAR0000:%.+]], i{{.+}} 0, i{{.+}} 2 - -// CK24-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3 -// CK24-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3 -// CK24-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3 -// CK24-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to [[SA]]*** -// CK24-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i32** -// CK24-DAG: store [[SA]]** [[SEC2]], [[SA]]*** [[CBP3]] -// CK24-DAG: store i32* [[SEC3:%.+]], i32** [[CP3]] -// CK24-DAG: store i64 {{.+}}, i64* [[S3]] -// CK24-DAG: [[SEC3]] = getelementptr {{.*}}[[SA]]* [[SEC33:%[^,]+]], i{{.+}} 0, i{{.+}} 0 -// CK24-DAG: [[SEC33]] = load [[SA]]*, [[SA]]** [[SEC333:%[^,]+]], -// CK24-DAG: [[SEC333]] = getelementptr {{.*}}[[SA]]* [[SEC3333:%[^,]+]], i{{.+}} 0, i{{.+}} 1 -// CK24-DAG: [[SEC3333]] = load [[SA]]*, [[SA]]** [[SEC33333:%[^,]+]], -// CK24-DAG: [[SEC33333]] = getelementptr {{.*}}[[SB]]* [[SEC333333:%[^,]+]], i{{.+}} 0, i{{.+}} 4 -// CK24-DAG: [[SEC333333]] = load [[SB]]*, [[SB]]** [[SEC3333333:%[^,]+]], -// CK24-DAG: [[SEC3333333]] = getelementptr {{.*}}[[SC]]* [[VAR00000:%.+]], i{{.+}} 0, i{{.+}} 2 - -// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR0000]] = load [[SC]]*, [[SC]]** %{{.+}} -// CK24-DAG: [[VAR00000]] = load [[SC]]*, [[SC]]** %{{.+}} - -// CK24: call void [[CALL24:@.+]]([[SC]]* {{[^,]+}}) -#pragma omp target map(p->p->p->p->a) - { p->a++; } - - return s.a; -} - -// CK24: define {{.+}}[[CALL01]] -// CK24: define {{.+}}[[CALL13]] -// CK24: define {{.+}}[[CALL14]] -// CK24: define {{.+}}[[CALL15]] -// CK24: define {{.+}}[[CALL16]] -// CK24: define {{.+}}[[CALL17]] -// CK24: define {{.+}}[[CALL18]] -// CK24: define {{.+}}[[CALL19]] -// CK24: define {{.+}}[[CALL20]] -// CK24: define {{.+}}[[CALL21]] -// CK24: define {{.+}}[[CALL22]] -// CK24: define {{.+}}[[CALL23]] -// CK24: define {{.+}}[[CALL24]] -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 -// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 -// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 -// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 - -// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 -// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 -// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 -// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 - -// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 -// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 -// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 -// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 - -// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s -// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s -// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s -// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s -// SIMD-ONLY24-NOT: {{__kmpc|__tgt}} -#ifdef CK25 -// CK25: [[ST:%.+]] = type { i32, float } -// CK25: [[CA00:%.+]] = type { [[ST]]* } -// CK25: [[CA01:%.+]] = type { i32* } - -// CK25-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK25: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710657] - -// CK25-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK25: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK25: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 33] - -// CK25-LABEL: explicit_maps_with_inner_lambda{{.*}}( - -template -struct CC { - T A; - float B; - - int foo(T arg) { - // Region 00 - // CK25-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) - // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK25-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK25-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK25-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** - // CK25-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK25-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] - // CK25-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK25-DAG: store i64 {{%.+}}, i64* [[S0]] - // CK25-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0 - - // CK25-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK25-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK25-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK25-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** - // CK25-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK25-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CBP1]] - // CK25-DAG: store i32* [[SEC0]], i32** [[CP1]] - // CK25-DAG: store i64 {{.+}}, i64* [[S1]] - - // CK25: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}}) - #pragma omp target map(to:A) - { - [&]() { - A += 1; - }(); - } - - // Region 01 - // CK25-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) - // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK25-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK25-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK25-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK25-DAG: store i32* [[VAR0]], i32** [[CP0]] - - // CK25: call void [[CALL01:@.+]](i32* {{[^,]+}}) - #pragma omp target map(to:arg) - { - [&]() { - arg += 1; - }(); - } - - return A+arg; - } -}; - -int explicit_maps_with_inner_lambda(int a){ - CC<123,int> c; - return c.foo(a); -} - -// CK25: define {{.+}}[[CALL00]]([[ST]]* [[VAL:%.+]]) -// CK25: store [[ST]]* [[VAL]], [[ST]]** [[VALADDR:%[^,]+]], -// CK25: [[VAL1:%.+]] = load [[ST]]*, [[ST]]** [[VALADDR]], -// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA00]], [[CA00]]* [[CA:%[^,]+]], i32 0, i32 0 -// CK25: store [[ST]]* [[VAL1]], [[ST]]** [[VALADDR1]], -// CK25: call void {{.*}}[[LAMBDA:@.+]]{{.*}}([[CA00]]* [[CA]]) - -// CK25: define {{.+}}[[LAMBDA]] - -// CK25: define {{.+}}[[CALL01]](i32* {{.*}}[[VAL:%.+]]) -// CK25: store i32* [[VAL]], i32** [[VALADDR:%[^,]+]], -// CK25: [[VAL1:%.+]] = load i32*, i32** [[VALADDR]], -// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA01]], [[CA01]]* [[CA:%[^,]+]], i32 0, i32 0 -// CK25: store i32* [[VAL1]], i32** [[VALADDR1]], -// CK25: call void {{.*}}[[LAMBDA2:@.+]]{{.*}}([[CA01]]* [[CA]]) - -// CK25: define {{.+}}[[LAMBDA2]] -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-64 -// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-64 -// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-32 -// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-32 - -// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-64 -// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-64 -// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-32 -// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-32 - -// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-64 -// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-64 -// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-32 -// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-32 - -// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY25 %s -// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY25 %s -// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY25 %s -// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY25 %s -// SIMD-ONLY25-NOT: {{__kmpc|__tgt}} -#ifdef CK26 -// CK26: [[ST:%.+]] = type { i32, float*, i32, float* } - -// CK26-LABEL: @.__omp_offloading_{{.*}}CC{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK26: [[SIZE00:@.+]] = private {{.*}}constant [2 x i64] [i64 {{32|16}}, i64 4] -// CK26: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i64] [i64 547, i64 35] - -// CK26-LABEL: @.__omp_offloading_{{.*}}CC{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK26: [[SIZE01:@.+]] = private {{.*}}constant [2 x i64] [i64 {{32|16}}, i64 4] -// CK26: [[MTYPE01:@.+]] = private {{.*}}constant [2 x i64] [i64 547, i64 35] - -// CK26-LABEL: @.__omp_offloading_{{.*}}CC{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK26: [[SIZE02:@.+]] = private {{.*}}constant [2 x i64] [i64 {{32|16}}, i64 4] -// CK26: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i64] [i64 547, i64 35] - -// CK26-LABEL: @.__omp_offloading_{{.*}}CC{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK26: [[SIZE03:@.+]] = private {{.*}}constant [2 x i64] [i64 {{32|16}}, i64 4] -// CK26: [[MTYPE03:@.+]] = private {{.*}}constant [2 x i64] [i64 547, i64 35] - -// CK26-LABEL: explicit_maps_with_private_class_members{{.*}}( - -struct CC { - int fA; - float &fB; - int pA; - float &pB; - - CC(float &B) : fB(B), pB(B) { - - // CK26: call {{.*}}@__kmpc_fork_call{{.*}} [[OUTCALL:@.+]] to void (i32*, i32*, ...)* - // define {{.*}}void [[OUTCALL]] - #pragma omp parallel firstprivate(fA,fB) private(pA,pB) - { - // Region 00 - // CK26-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) - // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** - // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]** - // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] - // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]] - - // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** - // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK26-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] - // CK26-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] - // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]], - // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]], - - // CK26: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}}) - #pragma omp target map(fA) - { - ++fA; - } - - // Region 01 - // CK26-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) - // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** - // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]** - // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] - // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]] - - // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float** - // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float** - // CK26-DAG: store float* [[VAR1:%.+]], float** [[CBP1]] - // CK26-DAG: store float* [[SEC1:%.+]], float** [[CP1]] - // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]], - // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]], - - // CK26: call void [[CALL01:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}}) - #pragma omp target map(fB) - { - fB += 1.0; - } - - // Region 02 - // CK26-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) - // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** - // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]** - // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] - // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]] - - // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** - // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK26-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] - // CK26-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] - // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]], - // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]], - - // CK26: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}}) - #pragma omp target map(pA) - { - ++pA; - } - - // Region 01 - // CK26-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE03]]{{.+}}, i8** null) - // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** - // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]** - // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] - // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]] - - // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float** - // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float** - // CK26-DAG: store float* [[VAR1:%.+]], float** [[CBP1]] - // CK26-DAG: store float* [[SEC1:%.+]], float** [[CP1]] - // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]], - // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]], - - // CK26: call void [[CALL03:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}}) - #pragma omp target map(pB) - { - pB += 1.0; - } - } - } - - int foo() { - return fA + pA; - } -}; - -// Make sure the private instance is used in all target regions. -// CK26: define {{.+}}[[CALL00]]({{.*}}i32*{{.*}}[[PVTARG:%.+]]) -// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]], -// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]], -// CK26: store i32* [[ADDR]], i32** [[PVTADDR:%.+]], -// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]], -// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]], -// CK26: add nsw i32 [[VAL]], 1 - -// CK26: define {{.+}}[[CALL01]]({{.*}}float*{{.*}}[[PVTARG:%.+]]) -// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]], -// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]], -// CK26: store float* [[ADDR]], float** [[PVTADDR:%.+]], -// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]], -// CK26: [[VAL:%.+]] = load float, float* [[ADDR]], -// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double -// CK26: fadd double [[EXT]], 1.000000e+00 - -// CK26: define {{.+}}[[CALL02]]({{.*}}i32*{{.*}}[[PVTARG:%.+]]) -// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]], -// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]], -// CK26: store i32* [[ADDR]], i32** [[PVTADDR:%.+]], -// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]], -// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]], -// CK26: add nsw i32 [[VAL]], 1 - -// CK26: define {{.+}}[[CALL03]]({{.*}}float*{{.*}}[[PVTARG:%.+]]) -// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]], -// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]], -// CK26: store float* [[ADDR]], float** [[PVTADDR:%.+]], -// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]], -// CK26: [[VAL:%.+]] = load float, float* [[ADDR]], -// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double -// CK26: fadd double [[EXT]], 1.000000e+00 - -int explicit_maps_with_private_class_members(){ - float B; - CC c(B); - return c.foo(); -} -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-64 -// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-64 -// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-32 -// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-32 - -// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-64 -// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-64 -// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-32 -// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-32 - -// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-64 -// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-64 -// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-32 -// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-32 - -// RUN: %clang_cc1 -DCK27 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s -// RUN: %clang_cc1 -DCK27 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s -// RUN: %clang_cc1 -DCK27 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s -// RUN: %clang_cc1 -DCK27 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s -// SIMD-ONLY26-NOT: {{__kmpc|__tgt}} -#ifdef CK27 - -// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK27: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] zeroinitializer -// CK27: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 544] - -// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK27: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] zeroinitializer -// CK27: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK27: [[SIZE02:@.+]] = private {{.*}}constant [1 x i64] zeroinitializer -// CK27: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK27: [[SIZE03:@.+]] = private {{.*}}constant [1 x i64] zeroinitializer -// CK27: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK27: [[SIZE05:@.+]] = private {{.*}}constant [1 x i64] zeroinitializer -// CK27: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 32] - -// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK27: [[SIZE07:@.+]] = private {{.*}}constant [1 x i64] [i64 4] -// CK27: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i64] [i64 288] - -// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK27: [[SIZE09:@.+]] = private {{.*}}constant [1 x i64] [i64 40] -// CK27: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 161] - -// CK27-LABEL: zero_size_section_and_private_maps{{.*}}( -void zero_size_section_and_private_maps (int ii){ - - // Map of a pointer. - int *pa; - - // Region 00 - // CK27-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) - // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK27-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK27-DAG: store i32* [[VAR0]], i32** [[CP0]] - - // CK27: call void [[CALL00:@.+]](i32* {{[^,]+}}) - #pragma omp target - { - pa[50]++; - } - - // Region 01 - // CK27-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) - // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] - // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] - // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0 - // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] - - // CK27: call void [[CALL01:@.+]](i32* {{[^,]+}}) - #pragma omp target map(pa[:0]) - { - pa[50]++; - } - - // Region 02 - // CK27-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) - // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] - // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] - // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0 - // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] - - // CK27: call void [[CALL02:@.+]](i32* {{[^,]+}}) - #pragma omp target map(pa[0:0]) - { - pa[50]++; - } - - // Region 03 - // CK27-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}}, i8** null) - // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] - // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] - // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] - // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.+}} - // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] - - // CK27: call void [[CALL03:@.+]](i32* {{[^,]+}}) - #pragma omp target map(pa[ii:0]) - { - pa[50]++; - } - - int *pvtPtr; - int pvtScl; - int pvtArr[10]; - - // Region 04 - // CK27: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i64* null, i8** null) - // CK27: call void [[CALL04:@.+]]() - #pragma omp target private(pvtPtr) - { - pvtPtr[5]++; - } - - // Region 05 - // CK27-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}}, i8** null) - // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK27-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK27-DAG: store i32* [[VAR0]], i32** [[CP0]] - - // CK27: call void [[CALL05:@.+]](i32* {{[^,]+}}) - #pragma omp target firstprivate(pvtPtr) - { - pvtPtr[5]++; - } - - // Region 06 - // CK27: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i64* null, i8** null) - // CK27: call void [[CALL06:@.+]]() - #pragma omp target private(pvtScl) - { - pvtScl++; - } - - // Region 07 - // CK27-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZE07]]{{.+}}, {{.+}}[[MTYPE07]]{{.+}}, i8** null) - // CK27-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 - // CK27-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 - // CK27-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 - // CK27-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 - // CK27-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z:64|32]]* - // CK27-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* - // CK27-DAG: store i[[Z]] [[VAL:%.+]], i[[Z]]* [[CBP1]] - // CK27-DAG: store i[[Z]] [[VAL]], i[[Z]]* [[CP1]] - // CK27-DAG: [[VAL]] = load i[[Z]], i[[Z]]* [[ADDR:%.+]], - // CK27-64-DAG: [[CADDR:%.+]] = bitcast i[[Z]]* [[ADDR]] to i32* - // CK27-64-DAG: store i32 {{.+}}, i32* [[CADDR]], - - // CK27: call void [[CALL07:@.+]](i[[Z]] [[VAL]]) - #pragma omp target firstprivate(pvtScl) - { - pvtScl++; - } - - // Region 08 - // CK27: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i64* null, i8** null) - // CK27: call void [[CALL08:@.+]]() - #pragma omp target private(pvtArr) - { - pvtArr[5]++; - } - - // Region 09 - // CK27-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}}, i8** null) - // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [10 x i32]** - // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [10 x i32]** - // CK27-DAG: store [10 x i32]* [[VAR0:%.+]], [10 x i32]** [[CBP0]] - // CK27-DAG: store [10 x i32]* [[VAR0]], [10 x i32]** [[CP0]] - - // CK27: call void [[CALL09:@.+]]([10 x i32]* {{[^,]+}}) - #pragma omp target firstprivate(pvtArr) - { - pvtArr[5]++; - } -} - -// CK27: define {{.+}}[[CALL00]] -// CK27: define {{.+}}[[CALL01]] -// CK27: define {{.+}}[[CALL02]] -// CK27: define {{.+}}[[CALL03]] -// CK27: define {{.+}}[[CALL04]] -// CK27: define {{.+}}[[CALL05]] -// CK27: define {{.+}}[[CALL06]] -// CK27: define {{.+}}[[CALL07]] -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-64 -// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-64 -// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-32 -// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-32 - -// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-64 -// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-64 -// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-32 -// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-32 - -// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-64 -// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-64 -// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-32 -// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-32 - -// RUN: %clang_cc1 -DCK28 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY27 %s -// RUN: %clang_cc1 -DCK28 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY27 %s -// RUN: %clang_cc1 -DCK28 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY27 %s -// RUN: %clang_cc1 -DCK28 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY27 %s -// SIMD-ONLY27-NOT: {{__kmpc|__tgt}} -#ifdef CK28 - -// CK28-LABEL: @.__omp_offloading_{{.*}}explicit_maps_pointer_references{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK28: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] -// CK28: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK28-LABEL: @.__omp_offloading_{{.*}}explicit_maps_pointer_references{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK28: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 400] -// CK28: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35] - -// CK28-LABEL: explicit_maps_pointer_references{{.*}}( -void explicit_maps_pointer_references (int *p){ - int *&a = p; - - // Region 00 - // CK28-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) - // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK28-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32*** - // CK28-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32*** - // CK28-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]] - // CK28-DAG: store i32** [[VAR1:%.+]], i32*** [[CP0]] - // CK28-DAG: [[VAR0]] = load i32**, i32*** [[VAR00:%.+]], - // CK28-DAG: [[VAR1]] = load i32**, i32*** [[VAR11:%.+]], - - // CK28: call void [[CALL00:@.+]](i32** {{[^,]+}}) - #pragma omp target map(a) - { - ++a; - } - - // Region 01 - // CK28-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) - // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK28-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK28-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK28-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK28-DAG: store i32* [[VAR1:%.+]], i32** [[CP0]] - // CK28-DAG: [[VAR0]] = load i32*, i32** [[VAR00:%.+]], - // CK28-DAG: [[VAR00]] = load i32**, i32*** [[VAR000:%.+]], - // CK28-DAG: [[VAR1]] = getelementptr inbounds i32, i32* [[VAR11:%.+]], i{{64|32}} 2 - // CK28-DAG: [[VAR11]] = load i32*, i32** [[VAR111:%.+]], - // CK28-DAG: [[VAR111]] = load i32**, i32*** [[VAR1111:%.+]], - - // CK28: call void [[CALL01:@.+]](i32* {{[^,]+}}) - #pragma omp target map(a[2:100]) - { - ++a; - } -} -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64 -// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64 -// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32 -// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32 - -// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64 -// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64 -// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32 -// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32 - -// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64 -// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64 -// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32 -// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32 - -// RUN: %clang_cc1 -DCK29 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s -// RUN: %clang_cc1 -DCK29 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s -// RUN: %clang_cc1 -DCK29 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s -// RUN: %clang_cc1 -DCK29 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s -// SIMD-ONLY28-NOT: {{__kmpc|__tgt}} -#ifdef CK29 - -// CK29: [[SSA:%.+]] = type { double*, double** } -// CK29: [[SSB:%.+]] = type { [[SSA]]*, [[SSA]]** } - -// CK29-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK29: [[MTYPE00:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710672, i64 19] - -// CK29-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK29: [[MTYPE01:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710672, i64 19] - -// CK29-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK29: [[MTYPE02:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710672, i64 19] - -struct SSA{ - double *p; - double *≺ - SSA(double *&pr) : pr(pr) {} -}; - -struct SSB{ - SSA *p; - SSA *≺ - SSB(SSA *&pr) : pr(pr) {} - - // CK29-LABEL: define {{.+}}foo - void foo() { - - // Region 00 - // CK29-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) - - // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK29-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK29-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]** - // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]** - // CK29-DAG: store [[SSB]]* [[VAR0:%.+]], [[SSB]]** [[CBP0]] - // CK29-DAG: store [[SSA]]** [[VAR00:%.+]], [[SSA]]*** [[CP0]] - // CK29-DAG: store i64 %{{.+}}, i64* [[S0]] - // CK29-DAG: [[VAR0]] = load [[SSB]]*, [[SSB]]** % - // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 0 - - // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK29-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]*** - // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double*** - // CK29-DAG: store [[SSA]]** [[VAR00]], [[SSA]]*** [[CBP1]] - // CK29-DAG: store double** [[VAR1:%.+]], double*** [[CP1]] - // CK29-DAG: store i64 {{8|4}}, i64* [[S1]] - // CK29-DAG: [[VAR1]] = load double**, double*** [[VAR1_REF:%.+]], - // CK29-DAG: [[VAR1_REF]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1 - - // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK29-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 - // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double*** - // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** - // CK29-DAG: store double** [[VAR1]], double*** [[CBP2]] - // CK29-DAG: store double* [[VAR2:%.+]], double** [[CP2]] - // CK29-DAG: store i64 80, i64* [[S2]] - // CK29-DAG: [[VAR2]] = getelementptr inbounds double, double* [[VAR22:%.+]], i{{.+}} 0 - // CK29-DAG: [[VAR22]] = load double*, double** %{{.+}}, - - // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}}) - #pragma omp target map(p->pr[:10]) - { - p->pr++; - } - - // Region 01 - // CK29-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) - - // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK29-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK29-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]** - // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]** - // CK29-DAG: store [[SSB]]* [[VAR0]], [[SSB]]** [[CBP0]] - // CK29-DAG: store [[SSA]]** [[VAR00:%.+]], [[SSA]]*** [[CP0]] - // CK29-DAG: store i64 %{{.+}}, i64* [[S0]] - // CK29-DAG: [[VAR00]] = load [[SSA]]**, [[SSA]]*** [[VAR000:%.+]], - // CK29-DAG: [[VAR000]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1 - - // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK29-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]*** - // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double*** - // CK29-DAG: store [[SSA]]** [[VAR00]], [[SSA]]*** [[CBP1]] - // CK29-DAG: store double** [[VAR1:%.+]], double*** [[CP1]] - // CK29-DAG: store i64 {{8|4}}, i64* [[S1]] - // CK29-DAG: [[VAR1]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 0 - - // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK29-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 - // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double*** - // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** - // CK29-DAG: store double** [[VAR1]], double*** [[CBP2]] - // CK29-DAG: store double* [[VAR2:%.+]], double** [[CP2]] - // CK29-DAG: store i64 80, i64* [[S2]] - // CK29-DAG: [[VAR2]] = getelementptr inbounds double, double* [[VAR22:%.+]], i{{.+}} 0 - // CK29-DAG: [[VAR22]] = load double*, double** %{{.+}}, - - // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}}) - #pragma omp target map(pr->p[:10]) - { - pr->p++; - } - - // Region 02 - // CK29-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) - - // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK29-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK29-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]** - // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]** - // CK29-DAG: store [[SSB]]* [[VAR0]], [[SSB]]** [[CBP0]] - // CK29-DAG: store [[SSA]]** [[VAR00:%.+]], [[SSA]]*** [[CP0]] - // CK29-DAG: store i64 %{{.+}}, i64* [[S0]] - // CK29-DAG: [[VAR00]] = load [[SSA]]**, [[SSA]]*** [[VAR000:%.+]], - // CK29-DAG: [[VAR000]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1 - - // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK29-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]*** - // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double*** - // CK29-DAG: store [[SSA]]** [[VAR00]], [[SSA]]*** [[CBP1]] - // CK29-DAG: store double** [[VAR1:%.+]], double*** [[CP1]] - // CK29-DAG: store i64 {{8|4}}, i64* [[S1]] - // CK29-DAG: [[VAR1]] = load double**, double*** [[VAR1_REF:%.+]], - // CK29-DAG: [[VAR1_REF]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1 - - // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK29-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 - // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double*** - // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** - // CK29-DAG: store double** [[VAR1]], double*** [[CBP2]] - // CK29-DAG: store double* [[VAR2:%.+]], double** [[CP2]] - // CK29-DAG: store i64 80, i64* [[S2]] - // CK29-DAG: [[VAR2]] = getelementptr inbounds double, double* [[VAR22:%.+]], i{{.+}} 0 - // CK29-DAG: [[VAR22]] = load double*, double** %{{.+}}, - - // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}}) - #pragma omp target map(pr->pr[:10]) - { - pr->pr++; - } - } -}; - -void explicit_maps_member_pointer_references(SSA *sap) { - double *d; - SSA sa(d); - SSB sb(sap); - sb.foo(); -} -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK30 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-64 -// RUN: %clang_cc1 -DCK30 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-64 -// RUN: %clang_cc1 -DCK30 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-32 -// RUN: %clang_cc1 -DCK30 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-32 - -// RUN: %clang_cc1 -DCK30 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-64 -// RUN: %clang_cc1 -DCK30 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-64 -// RUN: %clang_cc1 -DCK30 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-32 -// RUN: %clang_cc1 -DCK30 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-32 - -// RUN: %clang_cc1 -DCK30 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-64 -// RUN: %clang_cc1 -DCK30 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-64 -// RUN: %clang_cc1 -DCK30 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-32 -// RUN: %clang_cc1 -DCK30 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-32 - -// RUN: %clang_cc1 -DCK30 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY30 %s -// RUN: %clang_cc1 -DCK30 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY30 %s -// RUN: %clang_cc1 -DCK30 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY30 %s -// RUN: %clang_cc1 -DCK30 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY30 %s -// SIMD-ONLY30-NOT: {{__kmpc|__tgt}} -#ifdef CK30 - -// CK30-DAG: [[BASE:%.+]] = type { i32*, i32, i32* } -// CK30-DAG: [[STRUCT:%.+]] = type { [[BASE]], i32*, i32*, i32, i32* } - -// CK30-LABEL: @.__omp_offloading_{{.*}}map_with_deep_copy{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// The first element: 0x20 - OMP_MAP_TARGET_PARAM -// 2-4: 0x1000000000003 - OMP_MAP_MEMBER_OF(0) | OMP_MAP_TO | OMP_MAP_FROM - copies all the data in structs excluding deep-copied elements (from &s to &s.ptrBase1, from &s.ptr to &s.ptr1, from &s.ptr1 to end of s). -// 5-6: 0x1000000000013 - OMP_MAP_MEMBER_OF(0) | OMP_MAP_PTR_AND_OBJ | OMP_MAP_TO | OMP_MAP_FROM - deep copy of the pointers + pointee. -// CK30: [[MTYPE00:@.+]] = private {{.*}}constant [6 x i64] [i64 32, i64 281474976710659, i64 281474976710659, i64 281474976710659, i64 281474976710675, i64 281474976710675] - -typedef struct { - int *ptrBase; - int valBase; - int *ptrBase1; -} Base; - -typedef struct StructWithPtrTag : public Base { - int *ptr; - int *ptr2; - int val; - int *ptr1; -} StructWithPtr; - -// CK30-DAG: call i32 @__tgt_target_mapper(i64 -1, i8* @.__omp_offloading_{{.*}}map_with_deep_copy{{.*}}_l{{[0-9]+}}.region_id, i32 6, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], i64* getelementptr inbounds ([6 x i64], [6 x i64]* [[MTYPE00]], i32 0, i32 0), i8** null) -// CK30-DAG: [[GEPS]] = getelementptr inbounds [6 x i{{64|32}}], [6 x i64]* [[SIZES:%.+]], i32 0, i32 0 -// CK30-DAG: [[GEPP]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS:%.+]], i32 0, i32 0 -// CK30-DAG: [[GEPBP]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES:%.+]], i32 0, i32 0 - -// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 0 -// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to [[STRUCT]]** -// CK30-DAG: store [[STRUCT]]* [[S:%.+]], [[STRUCT]]** [[BC]], -// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 0 -// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to [[STRUCT]]** -// CK30-DAG: store [[STRUCT]]* [[S]], [[STRUCT]]** [[BC]], -// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i{{64|32}}], [6 x i64]* [[SIZES]], i32 0, i32 0 -// CK30-DAG: store i64 [[S_ALLOC_SIZE:%.+]], i64* [[SIZE]], -// CK30-DAG: [[S_ALLOC_SIZE]] = sdiv exact i64 [[DIFF:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) -// CK30-DAG: [[DIFF]] = sub i64 [[S_END_BC:%.+]], [[S_BEGIN_BC:%.+]] -// CK30-DAG: [[S_BEGIN_BC]] = ptrtoint i8* [[S_BEGIN:%.+]] to i64 -// CK30-DAG: [[S_END_BC]] = ptrtoint i8* [[S_END:%.+]] to i64 -// CK30-DAG: [[S_BEGIN]] = bitcast [[STRUCT]]* [[S]] to i8* -// CK30-DAG: [[S_END]] = getelementptr i8, i8* [[S_LAST:%.+]], i32 1 -// CK30-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_BC:%.+]], i{{64|32}} {{55|27}} -// CK30-DAG: [[S_BC]] = bitcast [[STRUCT]]* [[S]] to i8* - -// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 1 -// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to [[STRUCT]]** -// CK30-DAG: store [[STRUCT]]* [[S]], [[STRUCT]]** [[BC]], -// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 1 -// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to [[STRUCT]]** -// CK30-DAG: store [[STRUCT]]* [[S]], [[STRUCT]]** [[BC]], -// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i64], [6 x i64]* [[SIZES]], i32 0, i32 1 -// CK30-DAG: store i64 [[SIZE1:%.+]], i64* [[SIZE]], -// CK30-DAG: [[SIZE1]] = sdiv exact i64 [[DIFF:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) -// CK30-DAG: [[DIFF]] = sub i64 [[S_PTRBASE1_BC:%.+]], [[S_BEGIN_BC:%.+]] -// CK30-DAG: [[S_BEGIN_BC]] = ptrtoint i8* [[S_BEGIN:%.+]] to i64 -// CK30-DAG: [[S_PTRBASE1_BC]] = ptrtoint i8* [[S_PTRBASE1:%.+]] to i64 -// CK30-DAG: [[S_PTRBASE1]] = bitcast i32** [[S_PTRBASE1_REF:%.+]] to i8* -// CK30-DAG: [[S_BEGIN]] = bitcast [[STRUCT]]* [[S]] to i8* -// CK30-DAG: [[S_PTRBASE1_REF]] = getelementptr inbounds [[BASE]], [[BASE]]* [[BASE_ADDR:%.+]], i32 0, i32 2 -// CK30-DAG: [[BASE_ADDR]] = bitcast [[STRUCT]]* [[S]] to [[BASE]]* - -// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 2 -// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to [[STRUCT]]** -// CK30-DAG: store [[STRUCT]]* [[S]], [[STRUCT]]** [[BC]], -// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 2 -// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to i32*** -// CK30-DAG: store i32** [[PTR1:%.+]], i32*** [[BC]], -// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i64], [6 x i64]* [[SIZES]], i32 0, i32 2 -// CK30-DAG: store i64 [[SIZE2:%.+]], i64* [[SIZE]], -// CK30-DAG: [[PTR1]] = getelementptr i32*, i32** [[S_PTRBASE1_REF]], i{{64|32}} 1 -// CK30-DAG: [[SIZE2]] = sdiv exact i64 [[DIFF:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) -// CK30-DAG: [[DIFF]] = sub i64 [[S_PTR1_BC:%.+]], [[S_PTRBASE1_BC:%.+]] -// CK30-DAG: [[S_PTR1_BC]] = ptrtoint i8* [[S_PTR1:%.+]] to i64 -// CK30-DAG: [[S_PTRBASE1_BC]] = ptrtoint i8* [[S_PTRBASE1:%.+]] to i64 -// CK30-DAG: [[S_PTR1]] = bitcast i32** [[S_PTR1_REF:%.+]] to i8* -// CK30-DAG: [[S_PTRBASE1]] = bitcast i32** [[PTR1]] to i8* -// CK30-DAG: [[S_PTR1_REF]] = getelementptr inbounds [[STRUCT]], [[STRUCT]]* [[S]], i32 0, i32 4 - -// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 3 -// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to [[STRUCT]]** -// CK30-DAG: store [[STRUCT]]* [[S]], [[STRUCT]]** [[BC]], -// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 3 -// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to i32*** -// CK30-DAG: store i32** [[PTR2:%.+]], i32*** [[BC]], -// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i64], [6 x i64]* [[SIZES]], i32 0, i32 3 -// CK30-DAG: store i64 [[SIZE3:%.+]], i64* [[SIZE]], -// CK30-DAG: [[PTR2]] = getelementptr i32*, i32** [[S_PTR1_REF]], i{{64|32}} 1 -// CK30-DAG: [[SIZE3]] = sdiv exact i64 [[DIFF:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) -// CK30-DAG: [[DIFF]] = sub i64 [[S_END_BC:%.+]], [[S_PTR1_BC:%.+]] -// CK30-DAG: [[S_PTR1_BC]] = ptrtoint i8* [[S_PTR1:%.+]] to i64 -// CK30-DAG: [[S_END_BC]] = ptrtoint i8* [[S_END:%.+]] to i64 -// CK30-DAG: [[S_PTR1]] = bitcast i32** [[PTR2]] to i8* -// CK30-DAG: [[S_END]] = getelementptr i8, i8* [[S_LAST]], i{{64|32}} 1 - -// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 4 -// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to i32*** -// CK30-DAG: store i32** [[S_PTR1:%.+]], i32*** [[BC]], -// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 4 -// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to i32** -// CK30-DAG: store i32* [[S_PTR1_BEGIN:%.+]], i32** [[BC]], -// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i64], [6 x i64]* [[SIZES]], i32 0, i32 4 -// CK30-DAG: store i64 4, i64* [[SIZE]], -// CK30-DAG: [[S_PTR1]] = getelementptr inbounds [[STRUCT]], [[STRUCT]]* [[S]], i32 0, i32 4 -// CK30-DAG: [[S_PTR1_BEGIN]] = getelementptr inbounds i32, i32* [[S_PTR1_BEGIN_REF:%.+]], i{{64|32}} 0 -// CK30-DAG: [[S_PTR1_BEGIN_REF]] = load i32*, i32** [[S_PTR1:%.+]], -// CK30-DAG: [[S_PTR1]] = getelementptr inbounds [[STRUCT]], [[STRUCT]]* [[S]], i32 0, i32 4 - -// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 5 -// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to i32*** -// CK30-DAG: store i32** [[S_PTRBASE1:%.+]], i32*** [[BC]], -// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 5 -// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to i32** -// CK30-DAG: store i32* [[S_PTRBASE1_BEGIN:%.+]], i32** [[BC]], -// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i{{64|32}}], [6 x i{{64|32}}]* [[SIZES]], i32 0, i32 5 -// CK30-DAG: store i{{64|32}} 4, i{{64|32}}* [[SIZE]], -// CK30-DAG: [[S_PTRBASE1]] = getelementptr inbounds [[BASE]], [[BASE]]* [[S_BASE:%.+]], i32 0, i32 2 -// CK30-DAG: [[S_BASE]] = bitcast [[STRUCT]]* [[S]] to [[BASE]]* -// CK30-DAG: [[S_PTRBASE1_BEGIN]] = getelementptr inbounds i32, i32* [[S_PTRBASE1_BEGIN_REF:%.+]], i{{64|32}} 0 -// CK30-DAG: [[S_PTRBASE1_BEGIN_REF]] = load i32*, i32** [[S_PTRBASE1:%.+]], -// CK30-DAG: [[S_PTRBASE1]] = getelementptr inbounds [[BASE]], [[BASE]]* [[S_BASE:%.+]], i32 0, i32 2 -// CK30-DAG: [[S_BASE]] = bitcast [[STRUCT]]* [[S]] to [[BASE]]* -void map_with_deep_copy() { - StructWithPtr s; -#pragma omp target map(s, s.ptr1 [0:1], s.ptrBase1 [0:1]) - { - s.val++; - s.ptr1[0]++; - s.ptrBase1[0] = 10001; - } -} - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK31 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-64 -// RUN: %clang_cc1 -DCK31 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-64 -// RUN: %clang_cc1 -DCK31 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-32 -// RUN: %clang_cc1 -DCK31 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-32 - -// RUN: %clang_cc1 -DCK31 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-64 -// RUN: %clang_cc1 -DCK31 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-64 -// RUN: %clang_cc1 -DCK31 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-32 -// RUN: %clang_cc1 -DCK31 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-32 - -// RUN: %clang_cc1 -DCK31 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-64 -// RUN: %clang_cc1 -DCK31 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-64 -// RUN: %clang_cc1 -DCK31 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-32 -// RUN: %clang_cc1 -DCK31 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-32 - -// RUN: %clang_cc1 -DCK31 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DCK31 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DCK31 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DCK31 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// SIMD-ONLY18-NOT: {{__kmpc|__tgt}} -#ifdef CK31 - -// CK31-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK31: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4] -// CK31: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 1059] - -// CK31-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK31: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4] -// CK31: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 1063] - -// CK31-LABEL: explicit_maps_single{{.*}}( -void explicit_maps_single (int ii){ - // Map of a scalar. - int a = ii; - - // Close. - // Region 00 - // CK31-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) - // CK31-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK31-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK31-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK31-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK31-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK31-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK31-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK31-DAG: store i32* [[VAR0]], i32** [[CP0]] - - // CK31: call void [[CALL00:@.+]](i32* {{[^,]+}}) - #pragma omp target map(close, tofrom: a) - { - a++; - } - - // Always Close. - // Region 01 - // CK31-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) - // CK31-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK31-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK31-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK31-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK31-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK31-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK31-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK31-DAG: store i32* [[VAR0]], i32** [[CP0]] - - // CK31: call void [[CALL01:@.+]](i32* {{[^,]+}}) - #pragma omp target map(always close tofrom: a) - { - a++; - } -} -// CK31: define {{.+}}[[CALL00]] -// CK31: define {{.+}}[[CALL01]] - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DUSE -DCK31A -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-64,CK31A-USE -// RUN: %clang_cc1 -DUSE -DCK31A -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-64,CK31A-USE -// RUN: %clang_cc1 -DUSE -DCK31A -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-32,CK31A-USE -// RUN: %clang_cc1 -DUSE -DCK31A -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-32,CK31A-USE - -// RUN: %clang_cc1 -DUSE -DCK31A -verify -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DUSE -DCK31A -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DUSE -DCK31A -verify -fopenmp-version=51 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DUSE -DCK31A -fopenmp-version=51 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s - -// RUN: %clang_cc1 -DCK31A -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-64,CK31A-NOUSE -// RUN: %clang_cc1 -DCK31A -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-64,CK31A-NOUSE -// RUN: %clang_cc1 -DCK31A -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-32,CK31A-NOUSE -// RUN: %clang_cc1 -DCK31A -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-32,CK31A-NOUSE - -// RUN: %clang_cc1 -DCK31A -verify -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DCK31A -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DCK31A -verify -fopenmp-version=51 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DCK31A -fopenmp-version=51 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// SIMD-ONLY18-NOT: {{__kmpc|__tgt}} -#ifdef CK31A - -// CK31A: [[ST:%.+]] = type { i32, i32 } -struct ST { - int i; - int j; -}; - -// CK31A-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// -// PRESENT=0x1000 | TARGET_PARAM=0x20 = 0x1020 -// CK31A: [[MTYPE00:@.+]] = private {{.*}}constant [7 x i64] [i64 [[#0x1020]], -// -// MEMBER_OF_1=0x1000000000000 | FROM=0x2 | TO=0x1 = 0x1000000000003 -// MEMBER_OF_1=0x1000000000000 | PRESENT=0x1000 | FROM=0x2 | TO=0x1 = 0x1000000001003 -// PRESENT=0x1000 | TARGET_PARAM=0x20 | FROM=0x2 | TO=0x1 = 0x1023 -// CK31A-SAME: {{^}} i64 [[#0x1000000000003]], i64 [[#0x1000000001003]], i64 [[#0x1023]], -// -// PRESENT=0x1000 | TARGET_PARAM=0x20 = 0x1020 -// MEMBER_OF_5=0x5000000000000 | PRESENT=0x1000 | FROM=0x2 | TO=0x1 = 0x5000000001003 -// MEMBER_OF_5=0x5000000000000 | FROM=0x2 | TO=0x1 = 0x5000000000003 -// CK31A-SAME: {{^}} i64 [[#0x1020]], i64 [[#0x5000000001003]], i64 [[#0x5000000000003]]] - -// CK31A-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK31A: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4] -// -// PRESENT=0x1000 | CLOSE=0x400 | TARGET_PARAM=0x20 | ALWAYS=0x4 | FROM=0x2 | TO=0x1 = 0x1427 -// CK31A: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 [[#0x1427]]] - -// CK31A-LABEL: explicit_maps_single{{.*}}( -void explicit_maps_single (int ii){ - // CK31A: alloca i32 - - // Map of a scalar. - // CK31A: [[A:%.+]] = alloca i32 - int a = ii; - - // CK31A: [[ST1:%.+]] = alloca [[ST]] - // CK31A: [[ST2:%.+]] = alloca [[ST]] - struct ST st1; - struct ST st2; - - // Make sure the struct picks up present even if another element of the struct - // doesn't have present. - // Region 00 - // CK31A: [[ST1_I:%.+]] = getelementptr inbounds [[ST]], [[ST]]* [[ST1]], i{{.+}} 0, i{{.+}} 0 - // CK31A: [[ST1_J:%.+]] = getelementptr inbounds [[ST]], [[ST]]* [[ST1]], i{{.+}} 0, i{{.+}} 1 - // CK31A: [[ST2_I:%.+]] = getelementptr inbounds [[ST]], [[ST]]* [[ST2]], i{{.+}} 0, i{{.+}} 0 - // CK31A: [[ST2_J:%.+]] = getelementptr inbounds [[ST]], [[ST]]* [[ST2]], i{{.+}} 0, i{{.+}} 1 - // CK31A-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 7, i8** [[GEPBP:%[0-9]+]], i8** [[GEPP:%[0-9]+]], i64* [[GEPS:%.+]], i64* getelementptr {{.+}}[7 x i{{.+}}]* [[MTYPE00]]{{.+}}) - // CK31A-DAG: [[GEPS]] = getelementptr inbounds [7 x i64], [7 x i64]* [[S:%.+]], i{{.+}} 0, i{{.+}} 0 - // CK31A-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK31A-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // st1 - // CK31A-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK31A-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK31A-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK31A-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** - // CK31A-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK31A-DAG: store [[ST]]* [[ST1]], [[ST]]** [[CBP0]] - // CK31A-DAG: store i32* [[ST1_I]], i32** [[CP0]] - // CK31A-DAG: store i64 %{{.+}}, i64* [[S0]] - - // st1.i - // CK31A-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK31A-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK31A-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK31A-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** - // CK31A-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK31A-DAG: store [[ST]]* [[ST1]], [[ST]]** [[CBP1]] - // CK31A-DAG: store i32* [[ST1_I]], i32** [[CP1]] - // CK31A-DAG: store i64 4, i64* [[S1]] - - // st1.j - // CK31A-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK31A-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK31A-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 - // CK31A-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]** - // CK31A-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** - // CK31A-DAG: store [[ST]]* [[ST1]], [[ST]]** [[CBP2]] - // CK31A-DAG: store i32* [[ST1_J]], i32** [[CP2]] - // CK31A-DAG: store i64 4, i64* [[S2]] - - // a - // CK31A-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3 - // CK31A-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3 - // CK31A-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3 - // CK31A-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to i32** - // CK31A-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i32** - // CK31A-DAG: store i32* [[A]], i32** [[CBP3]] - // CK31A-DAG: store i32* [[A]], i32** [[CP3]] - // CK31A-DAG: store i64 4, i64* [[S3]] - - // st2 - // CK31A-DAG: [[BP4:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 4 - // CK31A-DAG: [[P4:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 4 - // CK31A-DAG: [[S4:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 4 - // CK31A-DAG: [[CBP4:%.+]] = bitcast i8** [[BP4]] to [[ST]]** - // CK31A-DAG: [[CP4:%.+]] = bitcast i8** [[P4]] to i32** - // CK31A-DAG: store [[ST]]* [[ST2]], [[ST]]** [[CBP4]] - // CK31A-DAG: store i32* [[ST2_I]], i32** [[CP4]] - // CK31A-DAG: store i64 %{{.+}}, i64* [[S4]] - - // st2.i - // CK31A-DAG: [[BP5:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 5 - // CK31A-DAG: [[P5:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 5 - // CK31A-DAG: [[S5:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 5 - // CK31A-DAG: [[CBP5:%.+]] = bitcast i8** [[BP5]] to [[ST]]** - // CK31A-DAG: [[CP5:%.+]] = bitcast i8** [[P5]] to i32** - // CK31A-DAG: store [[ST]]* [[ST2]], [[ST]]** [[CBP5]] - // CK31A-DAG: store i32* [[ST2_I]], i32** [[CP5]] - // CK31A-DAG: store i64 4, i64* [[S5]] - - // st2.j - // CK31A-DAG: [[BP6:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 6 - // CK31A-DAG: [[P6:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 6 - // CK31A-DAG: [[S6:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 6 - // CK31A-DAG: [[CBP6:%.+]] = bitcast i8** [[BP6]] to [[ST]]** - // CK31A-DAG: [[CP6:%.+]] = bitcast i8** [[P6]] to i32** - // CK31A-DAG: store [[ST]]* [[ST2]], [[ST]]** [[CBP6]] - // CK31A-DAG: store i32* [[ST2_J]], i32** [[CP6]] - // CK31A-DAG: store i64 4, i64* [[S6]] - - // CK31A-USE: call void [[CALL00:@.+]]([[ST]]* [[ST1]], i32* [[A]], [[ST]]* [[ST2]]) - // CK31A-NOUSE: call void [[CALL00:@.+]]() - #pragma omp target map(tofrom: st1.i) map(present, tofrom: a, st1.j, st2.i) map(tofrom: st2.j) - { -#ifdef USE - st1.i++; - a++; - st1.j++; - st2.i++; - st2.j++; -#endif - } - - // Always Close Present. - // Region 01 - // CK31A-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}) - // CK31A-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK31A-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // CK31A-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK31A-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK31A-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** - // CK31A-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK31A-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] - // CK31A-DAG: store i32* [[VAR0]], i32** [[CP0]] - - // CK31A-USE: call void [[CALL01:@.+]](i32* {{[^,]+}}) - // CK31A-NOUSE: call void [[CALL01:@.+]]() - #pragma omp target map(always close present tofrom: a) - { -#ifdef USE - a++; -#endif - } -} -// CK31A: define {{.+}}[[CALL00]] -// CK31A: define {{.+}}[[CALL01]] - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DUSE -DCK31B -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-64,CK31B-USE -// RUN: %clang_cc1 -DUSE -DCK31B -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-64,CK31B-USE -// RUN: %clang_cc1 -DUSE -DCK31B -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-32,CK31B-USE -// RUN: %clang_cc1 -DUSE -DCK31B -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-32,CK31B-USE - -// RUN: %clang_cc1 -DUSE -DCK31B -verify -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DUSE -DCK31B -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DUSE -DCK31B -verify -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DUSE -DCK31B -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s - -// RUN: %clang_cc1 -DCK31B -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-64,CK31B-NOUSE -// RUN: %clang_cc1 -DCK31B -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-64,CK31B-NOUSE -// RUN: %clang_cc1 -DCK31B -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-32,CK31B-NOUSE -// RUN: %clang_cc1 -DCK31B -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-32,CK31B-NOUSE - -// RUN: %clang_cc1 -DCK31B -verify -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DCK31B -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DCK31B -verify -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// RUN: %clang_cc1 -DCK31B -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s -// SIMD-ONLY18-NOT: {{__kmpc|__tgt}} -#ifdef CK31B - -// CK31B: [[ST:%.+]] = type { i32, i32 } - -// PRESENT=0x1000 | TARGET_PARAM=0x20 = 0x1020 -// MEMBER_OF_1=0x1000000000000 | FROM=0x2 | TO=0x1 = 0x1000000000003 -// MEMBER_OF_1=0x1000000000000 | PRESENT=0x1000 | FROM=0x2 | TO=0x1 = 0x1000000001003 - -// CK31B-LABEL: @.__omp_offloading_{{.*}}test_present_members{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 -// CK31B: [[MTYPE00:@.+]] = private {{.*}}constant [3 x i64] [i64 [[#0x1020]], -// CK31B-SAME: {{^}} i64 [[#0x1000000000003]], i64 [[#0x1000000001003]]] - -struct ST { - int i; - int j; - // CK31B-LABEL: define {{.*}}test_present_members{{.*}}( - void test_present_members() { - // Make sure the struct picks up present even if another element of the - // struct doesn't have present. - // Region 00 - // CK31B: [[I:%.+]] = getelementptr inbounds [[ST]], [[ST]]* [[THIS:%.+]], i{{.+}} 0, i{{.+}} 0 - // CK31B: [[J:%.+]] = getelementptr inbounds [[ST]], [[ST]]* [[THIS]], i{{.+}} 0, i{{.+}} 1 - // CK31B-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%[0-9]+]], i8** [[GEPP:%[0-9]+]], i64* [[GEPS:%.+]], i64* getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE00]]{{.+}}) - // CK31B-DAG: [[GEPS]] = getelementptr inbounds [3 x i64], [3 x i64]* [[S:%.+]], i{{.+}} 0, i{{.+}} 0 - // CK31B-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK31B-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - - // this - // CK31B-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK31B-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK31B-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - // CK31B-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** - // CK31B-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** - // CK31B-DAG: store [[ST]]* [[THIS]], [[ST]]** [[CBP0]] - // CK31B-DAG: store i32* [[I]], i32** [[CP0]] - // CK31B-DAG: store i64 %{{.+}}, i64* [[S0]] - - // i - // CK31B-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 - // CK31B-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 - // CK31B-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 - // CK31B-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** - // CK31B-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** - // CK31B-DAG: store [[ST]]* [[THIS]], [[ST]]** [[CBP1]] - // CK31B-DAG: store i32* [[I]], i32** [[CP1]] - // CK31B-DAG: store i64 4, i64* [[S1]] - - // j - // CK31B-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 - // CK31B-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 - // CK31B-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 - // CK31B-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]** - // CK31B-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** - // CK31B-DAG: store [[ST]]* [[THIS]], [[ST]]** [[CBP2]] - // CK31B-DAG: store i32* [[J]], i32** [[CP2]] - // CK31B-DAG: store i64 4, i64* [[S2]] - - // CK31B-USE: call void [[CALL00:@.+]]([[ST]]* [[THIS]]) - // CK31B-NOUSE: call void [[CALL00:@.+]]() - #pragma omp target map(tofrom: i) map(present, tofrom: j) - { -#ifdef USE - i++; - j++; -#endif - } - } -}; - -void test() { - ST s; - s.test_present_members(); -} - -// CK31B: define {{.+}}[[CALL00]] - -#endif -///==========================================================================/// -// RUN: %clang_cc1 -DCK32 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK32 --check-prefix CK32-64 -// RUN: %clang_cc1 -DCK32 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK32 --check-prefix CK32-64 -// RUN: %clang_cc1 -DCK32 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK32 --check-prefix CK32-32 -// RUN: %clang_cc1 -DCK32 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK32 --check-prefix CK32-32 - -// RUN: %clang_cc1 -DCK32 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY32 %s -// RUN: %clang_cc1 -DCK32 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY32 %s -// RUN: %clang_cc1 -DCK32 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY32 %s -// RUN: %clang_cc1 -DCK32 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY32 %s -// SIMD-ONLY32-NOT: {{__kmpc|__tgt}} -#ifdef CK32 - -// CK32-DAG: [[MTYPE_TO:@.+]] = {{.+}}constant [1 x i64] [i64 33] -// CK32-DAG: [[MTYPE_FROM:@.+]] = {{.+}}constant [1 x i64] [i64 34] - -void array_shaping(float *f, int sa) { - - // CK32-DAG: call i32 @__tgt_target_mapper(i64 -1, i8* @{{.+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE_TO]]{{.+}}, i8** null) - // CK32-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK32-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK32-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK32-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK32-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK32-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - - // CK32-DAG: [[BPC0:%.+]] = bitcast i8** [[BP0]] to float** - // CK32-DAG: [[PC0:%.+]] = bitcast i8** [[P0]] to float** - - // CK32-DAG: store float* [[F1:%.+]], float** [[BPC0]], - // CK32-DAG: store float* [[F2:%.+]], float** [[PC0]], - // CK32-DAG: store i64 [[SIZE:%.+]], i64* [[S0]], - - // CK32-DAG: [[F1]] = load float*, float** [[F_ADDR:%.+]], - // CK32-DAG: [[F2]] = load float*, float** [[F_ADDR]], - // CK32-64-DAG: [[SIZE]] = mul nuw i64 [[SZ1:%.+]], 4 - // CK32-64-DAG: [[SZ1]] = mul nuw i64 12, %{{.+}} - // CK32-32-DAG: [[SIZE]] = sext i32 [[SZ1:%.+]] to i64 - // CK32-32-DAG: [[SZ1]] = mul nuw i32 [[SZ2:%.+]], 4 - // CK32-32-DAG: [[SZ2]] = mul nuw i32 12, %{{.+}} - #pragma omp target map(to:([3][sa][4])f) - f[0] = 1; - sa = 1; - // CK32-DAG: call i32 @__tgt_target_mapper(i64 -1, i8* @{{.+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE_FROM]]{{.+}}, i8** null) - // CK32-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] - // CK32-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] - // CK32-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] - - // CK32-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 - // CK32-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 - // CK32-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 - - // CK32-DAG: [[BPC0:%.+]] = bitcast i8** [[BP0]] to float** - // CK32-DAG: [[PC0:%.+]] = bitcast i8** [[P0]] to float** - - // CK32-DAG: store float* [[F1:%.+]], float** [[BPC0]], - // CK32-DAG: store float* [[F2:%.+]], float** [[PC0]], - // CK32-DAG: store i64 [[SIZE:%.+]], i64* [[S0]], - - // CK32-DAG: [[F1]] = load float*, float** [[F_ADDR:%.+]], - // CK32-DAG: [[F2]] = load float*, float** [[F_ADDR]], - // CK32-64-DAG: [[SIZE]] = mul nuw i64 [[SZ1:%.+]], 5 - // CK32-64-DAG: [[SZ1]] = mul nuw i64 4, %{{.+}} - // CK32-32-DAG: [[SIZE]] = sext i32 [[SZ1:%.+]] to i64 - // CK32-32-DAG: [[SZ1]] = mul nuw i32 [[SZ2:%.+]], 5 - // CK32-32-DAG: [[SZ2]] = mul nuw i32 4, %{{.+}} - #pragma omp target map(from: ([sa][5])f) - f[0] = 1; -} - -#endif -#endif diff --git a/clang/test/OpenMP/target_map_codegen_00.cpp b/clang/test/OpenMP/target_map_codegen_00.cpp new file mode 100644 index 00000000000000..ced6a9c528a5c9 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_00.cpp @@ -0,0 +1,104 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +/// +/// Implicit maps. +/// + +///==========================================================================/// +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-64 +// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-64 +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-32 +// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-32 + +// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s + +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-64 +// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-64 +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-32 +// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-32 + +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-64 +// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-64 +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-32 +// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-32 + +// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s +// SIMD-ONLY0-NOT: {{__kmpc|__tgt}} + +#ifdef CK1 + +class B { +public: + static double VAR; + B() { + } + + static void modify(int &res) { +#pragma omp target map(tofrom \ + : res) + { + res = B::VAR; + } + } +}; +double B::VAR = 1.0; + +// CK1-LABEL: @.__omp_offloading_{{.*}}implicit_maps_integer{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 + +// CK1-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] +// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK1-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] + +// CK1-LABEL: implicit_maps_integer{{.*}}( +void implicit_maps_integer (int a){ + // CK1: call void{{.*}}modify + B::modify(a); + int i = a; + + // CK1-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK1-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK1-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK1-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK1-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK1-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* + // CK1-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* + // CK1-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] + // CK1-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] + // CK1-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK1-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* + // CK1-64-DAG: store i32 {{.+}}, i32* [[CADDR]], + + // CK1: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) + #pragma omp target + { + ++i; + } +} + +// CK1: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) +// CK1: [[ADDR:%.+]] = alloca i[[sz]], +// CK1: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], +// CK1-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32* +// CK1-64: {{.+}} = load i32, i32* [[CADDR]], +// CK1-32: {{.+}} = load i32, i32* [[ADDR]], + +#endif // CK1 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_01.cpp b/clang/test/OpenMP/target_map_codegen_01.cpp new file mode 100644 index 00000000000000..cf84e04d44b3f7 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_01.cpp @@ -0,0 +1,111 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + + + +///==========================================================================/// +// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-64 +// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-64 +// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-32 +// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-32 + +// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-64 +// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-64 +// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-32 +// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-32 + +// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-64 +// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-64 +// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-32 +// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-32 + +// RUN: %clang_cc1 -DCK2 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY1 %s +// RUN: %clang_cc1 -DCK2 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY1 %s +// RUN: %clang_cc1 -DCK2 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY1 %s +// RUN: %clang_cc1 -DCK2 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY1 %s +// SIMD-ONLY1-NOT: {{__kmpc|__tgt}} +#ifdef CK2 + +// CK2-LABEL: @.__omp_offloading_{{.*}}implicit_maps_reference{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 + +// CK2: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] +// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK2: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] +// CK2-LABEL: @.__omp_offloading_{{.*}}implicit_maps_reference{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK2: [[SIZES2:@.+]] = {{.+}}constant [1 x i64] zeroinitializer +// Map types: OMP_MAP_IS_PTR | OMP_MAP_IMPLICIT = 544 +// CK2: [[TYPES2:@.+]] = {{.+}}constant [1 x i64] [i64 544] + +// CK2-LABEL: implicit_maps_reference{{.*}}( +void implicit_maps_reference (int a, int *b){ + int &i = a; + // CK2-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK2-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* + // CK2-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* + // CK2-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] + // CK2-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] + // CK2-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK2-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* + // CK2-64-DAG: store i32 {{.+}}, i32* [[CADDR]], + + // CK2: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) + #pragma omp target + { + ++i; + } + + int *&p = b; + // CK2-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES2]]{{.+}}, {{.+}}[[TYPES2]]{{.+}}, i8** null) + // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK2-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** + // CK2-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK2-DAG: store i32* [[VAL:%[^,]+]], i32** [[CBP1]] + // CK2-DAG: store i32* [[VAL]], i32** [[CP1]] + // CK2-DAG: [[VAL]] = load i32*, i32** [[ADDR:%.+]], + // CK2-DAG: [[ADDR]] = load i32**, i32*** [[ADDR2:%.+]], + + // CK2: call void [[KERNEL2:@.+]](i32* [[VAL]]) + #pragma omp target + { + ++p; + } +} + +// CK2: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) +// CK2: [[ADDR:%.+]] = alloca i[[sz]], +// CK2: [[REF:%.+]] = alloca i32*, +// CK2: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], +// CK2-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* +// CK2-64: store i32* [[CADDR]], i32** [[REF]], +// CK2-64: [[RVAL:%.+]] = load i32*, i32** [[REF]], +// CK2-64: {{.+}} = load i32, i32* [[RVAL]], +// CK2-32: store i32* [[ADDR]], i32** [[REF]], +// CK2-32: [[RVAL:%.+]] = load i32*, i32** [[REF]], +// CK2-32: {{.+}} = load i32, i32* [[RVAL]], + +// CK2: define internal void [[KERNEL2]](i32* [[ARG:%.+]]) +// CK2: [[ADDR:%.+]] = alloca i32*, +// CK2: [[REF:%.+]] = alloca i32**, +// CK2: store i32* [[ARG]], i32** [[ADDR]], +// CK2: store i32** [[ADDR]], i32*** [[REF]], +// CK2: [[T:%.+]] = load i32**, i32*** [[REF]], +// CK2: [[TT:%.+]] = load i32*, i32** [[T]], +// CK2: getelementptr inbounds i32, i32* [[TT]], i32 1 +#endif // CK2 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_02.cpp b/clang/test/OpenMP/target_map_codegen_02.cpp new file mode 100644 index 00000000000000..d70dc7a6974a43 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_02.cpp @@ -0,0 +1,73 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-64 +// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-64 +// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-32 +// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-32 + +// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-64 +// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-64 +// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-32 +// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-32 + +// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-64 +// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-64 +// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-32 +// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-32 + +// RUN: %clang_cc1 -DCK3 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY2 %s +// RUN: %clang_cc1 -DCK3 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY2 %s +// RUN: %clang_cc1 -DCK3 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY2 %s +// RUN: %clang_cc1 -DCK3 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY2 %s +// SIMD-ONLY2-NOT: {{__kmpc|__tgt}} +#ifdef CK3 + +// CK3-LABEL: @.__omp_offloading_{{.*}}implicit_maps_parameter{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 + +// CK3-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] +// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK3-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] + +// CK3-LABEL: implicit_maps_parameter{{.*}}( +void implicit_maps_parameter (int a){ + + // CK3-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK3-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK3-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK3-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK3-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK3-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* + // CK3-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* + // CK3-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] + // CK3-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] + // CK3-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK3-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* + // CK3-64-DAG: store i32 {{.+}}, i32* [[CADDR]], + + // CK3: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) + #pragma omp target + { + ++a; + } +} + +// CK3: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) +// CK3: [[ADDR:%.+]] = alloca i[[sz]], +// CK3: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], +// CK3-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32* +// CK3-64: {{.+}} = load i32, i32* [[CADDR]], +// CK3-32: {{.+}} = load i32, i32* [[ADDR]], + +#endif // CK3 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_03.cpp b/clang/test/OpenMP/target_map_codegen_03.cpp new file mode 100644 index 00000000000000..3f885bb6de8f12 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_03.cpp @@ -0,0 +1,85 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64 +// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64 +// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32 +// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32 + +// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64 +// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64 +// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32 +// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32 + +// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64 +// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64 +// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32 +// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32 + +// RUN: %clang_cc1 -DCK4 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY3 %s +// RUN: %clang_cc1 -DCK4 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY3 %s +// RUN: %clang_cc1 -DCK4 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY3 %s +// RUN: %clang_cc1 -DCK4 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY3 %s +// SIMD-ONLY3-NOT: {{__kmpc|__tgt}} +#ifdef CK4 + +// CK4-LABEL: @.__omp_offloading_{{.*}}implicit_maps_nested_integer{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 + +// CK4-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] +// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK4-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] + +// CK4-LABEL: implicit_maps_nested_integer{{.*}}( +void implicit_maps_nested_integer (int a){ + int i = a; + + // The captures in parallel are by reference. Only the capture in target is by + // copy. + + // CK4: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP1:@.+]] to void (i32*, i32*, ...)*), i32* {{.+}}) + // CK4: define internal void [[KERNELP1]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}}) + #pragma omp parallel + { + // CK4-DAG: call i32 @__tgt_target_teams_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null, i32 1, i32 0) + // CK4-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK4-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK4-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK4-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK4-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* + // CK4-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* + // CK4-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] + // CK4-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] + // CK4-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK4-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* + // CK4-64-DAG: store i32 {{.+}}, i32* [[CADDR]], + + // CK4: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) + #pragma omp target + { + #pragma omp parallel + { + ++i; + } + } + } +} + +// CK4: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) +// CK4: [[ADDR:%.+]] = alloca i[[sz]], +// CK4: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], +// CK4-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32* +// CK4-64: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[CADDR]]) +// CK4-32: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[ADDR]]) +// CK4: define internal void [[KERNELP2]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}}) +#endif // CK4 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_04.cpp b/clang/test/OpenMP/target_map_codegen_04.cpp new file mode 100644 index 00000000000000..b8120aae0a6106 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_04.cpp @@ -0,0 +1,80 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-64 +// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-64 +// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-32 +// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-32 + +// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-64 +// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-64 +// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-32 +// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-32 + +// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-64 +// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-64 +// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-32 +// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-32 + +// RUN: %clang_cc1 -DCK5 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY4 %s +// RUN: %clang_cc1 -DCK5 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY4 %s +// RUN: %clang_cc1 -DCK5 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY4 %s +// RUN: %clang_cc1 -DCK5 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY4 %s +// SIMD-ONLY4-NOT: {{__kmpc|__tgt}} +#ifdef CK5 + +// CK5-LABEL: @.__omp_offloading_{{.*}}implicit_maps_nested_integer_and_enum{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 + +// CK5-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] +// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK5-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] + +// CK5-LABEL: implicit_maps_nested_integer_and_enum{{.*}}( +void implicit_maps_nested_integer_and_enum (int a){ + enum Bla { + SomeEnum = 0x09 + }; + + // Using an enum should not change the mapping information. + int i = a; + + // CK5-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK5-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK5-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK5-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK5-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK5-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* + // CK5-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* + // CK5-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] + // CK5-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] + // CK5-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK5-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* + // CK5-64-DAG: store i32 {{.+}}, i32* [[CADDR]], + + // CK5: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) + #pragma omp target + { + ++i; + i += SomeEnum; + } +} + +// CK5: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) +// CK5: [[ADDR:%.+]] = alloca i[[sz]], +// CK5: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], +// CK5-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32* +// CK5-64: {{.+}} = load i32, i32* [[CADDR]], +// CK5-32: {{.+}} = load i32, i32* [[ADDR]], + +#endif // CK5 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_05.cpp b/clang/test/OpenMP/target_map_codegen_05.cpp new file mode 100644 index 00000000000000..b7d157e88d4706 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_05.cpp @@ -0,0 +1,75 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-64 +// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-64 +// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-32 +// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-32 + +// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-64 +// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-64 +// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-32 +// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-32 + +// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-64 +// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-64 +// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-32 +// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-32 + +// RUN: %clang_cc1 -DCK6 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY5 %s +// RUN: %clang_cc1 -DCK6 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY5 %s +// RUN: %clang_cc1 -DCK6 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY5 %s +// RUN: %clang_cc1 -DCK6 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY5 %s +// SIMD-ONLY5-NOT: {{__kmpc|__tgt}} +#ifdef CK6 +// CK6-DAG: @.__omp_offloading_{{.*}}implicit_maps_host_global{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 + +// CK6-DAG: [[GBL:@Gi]] = global i32 0 +// CK6-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] +// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK6-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] + +// CK6-LABEL: implicit_maps_host_global{{.*}}( +int Gi; +void implicit_maps_host_global (int a){ + // CK6-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK6-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK6-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK6-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK6-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK6-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* + // CK6-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* + // CK6-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] + // CK6-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] + // CK6-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK6-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* + // CK6-64-DAG: store i32 [[GBLVAL:%.+]], i32* [[CADDR]], + // CK6-64-DAG: [[GBLVAL]] = load i32, i32* [[GBL]], + // CK6-32-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[GBLVAL:%.+]], + + // CK6: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) + #pragma omp target + { + ++Gi; + } +} + +// CK6: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) +// CK6: [[ADDR:%.+]] = alloca i[[sz]], +// CK6: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], +// CK6-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32* +// CK6-64: {{.+}} = load i32, i32* [[CADDR]], +// CK6-32: {{.+}} = load i32, i32* [[ADDR]], + +#endif // CK6 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_06.cpp b/clang/test/OpenMP/target_map_codegen_06.cpp new file mode 100644 index 00000000000000..17271ca2e93afa --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_06.cpp @@ -0,0 +1,91 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-64 +// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-64 +// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-32 +// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-32 + +// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-64 +// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-64 +// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-32 +// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-32 + +// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-64 +// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-64 +// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-32 +// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-32 + +// RUN: %clang_cc1 -DCK7 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s +// RUN: %clang_cc1 -DCK7 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s +// RUN: %clang_cc1 -DCK7 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s +// RUN: %clang_cc1 -DCK7 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s +// SIMD-ONLY6-NOT: {{__kmpc|__tgt}} +#ifdef CK7 + +// For a 32-bit targets, the value doesn't fit the size of the pointer, +// therefore it is passed by reference with a map 'to' specification. + +// CK7-LABEL: @.__omp_offloading_{{.*}}implicit_maps_double{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 + +// CK7-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] +// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK7-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] +// Map types: OMP_MAP_TO | OMP_MAP_PRIVATE | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 673 +// CK7-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 673] + +// CK7-LABEL: implicit_maps_double{{.*}}( +void implicit_maps_double (int a){ + double d = (double)a; + + // CK7-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK7-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK7-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK7-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK7-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + + // CK7-64-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* + // CK7-64-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* + // CK7-64-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] + // CK7-64-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] + // CK7-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK7-64-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to double* + // CK7-64-64-DAG: store double {{.+}}, double* [[CADDR]], + + // CK7-32-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double** + // CK7-32-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double** + // CK7-32-DAG: store double* [[DECL:%[^,]+]], double** [[CBP1]] + // CK7-32-DAG: store double* [[DECL]], double** [[CP1]] + + // CK7-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) + // CK7-32: call void [[KERNEL:@.+]](double* [[DECL]]) + #pragma omp target + { + d += 1.0; + } +} + +// CK7-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) +// CK7-64: [[ADDR:%.+]] = alloca i[[sz]], +// CK7-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], +// CK7-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to double* +// CK7-64: {{.+}} = load double, double* [[CADDR]], + +// CK7-32: define internal void [[KERNEL]](double* {{.+}}[[ARG:%.+]]) +// CK7-32: [[ADDR:%.+]] = alloca double*, +// CK7-32: store double* [[ARG]], double** [[ADDR]], +// CK7-32: [[REF:%.+]] = load double*, double** [[ADDR]], +// CK7-32: {{.+}} = load double, double* [[REF]], + +#endif // CK7 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_07.cpp b/clang/test/OpenMP/target_map_codegen_07.cpp new file mode 100644 index 00000000000000..845fc1341083cf --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_07.cpp @@ -0,0 +1,73 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 +// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 +// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 +// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 + +// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 +// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 +// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 +// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 + +// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 +// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 +// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 +// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 + +// RUN: %clang_cc1 -DCK8 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY7 %s +// RUN: %clang_cc1 -DCK8 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY7 %s +// RUN: %clang_cc1 -DCK8 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY7 %s +// RUN: %clang_cc1 -DCK8 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY7 %s +// SIMD-ONLY7-NOT: {{__kmpc|__tgt}} +#ifdef CK8 + +// CK8-LABEL: @.__omp_offloading_{{.*}}implicit_maps_float{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 + +// CK8-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] +// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK8-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] + +// CK8-LABEL: implicit_maps_float{{.*}}( +void implicit_maps_float (int a){ + float f = (float)a; + + // CK8-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK8-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK8-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK8-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK8-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK8-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* + // CK8-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* + // CK8-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] + // CK8-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] + // CK8-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK8-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float* + // CK8-DAG: store float {{.+}}, float* [[CADDR]], + + // CK8: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) + #pragma omp target + { + f += 1.0; + } +} + +// CK8: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) +// CK8: [[ADDR:%.+]] = alloca i[[sz]], +// CK8: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], +// CK8: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float* +// CK8: {{.+}} = load float, float* [[CADDR]], + +#endif // CK8 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_08.cpp b/clang/test/OpenMP/target_map_codegen_08.cpp new file mode 100644 index 00000000000000..d1a437da86e71d --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_08.cpp @@ -0,0 +1,70 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 +// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 +// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 +// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 + +// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 +// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 +// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 +// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 + +// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 +// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 +// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 +// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 + +// RUN: %clang_cc1 -DCK9 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK9 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK9 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK9 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// SIMD-ONLY8-NOT: {{__kmpc|__tgt}} +#ifdef CK9 + +// CK9-LABEL: @.__omp_offloading_{{.*}}implicit_maps_array{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 + +// CK9-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] +// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547 +// CK9-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 547] + +// CK9-LABEL: implicit_maps_array{{.*}}( +void implicit_maps_array (int a){ + double darr[2] = {(double)a, (double)a}; + + // CK9-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK9-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK9-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK9-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK9-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK9-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [2 x double]** + // CK9-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [2 x double]** + // CK9-DAG: store [2 x double]* [[DECL:%[^,]+]], [2 x double]** [[CBP1]] + // CK9-DAG: store [2 x double]* [[DECL]], [2 x double]** [[CP1]] + + // CK9: call void [[KERNEL:@.+]]([2 x double]* [[DECL]]) + #pragma omp target + { + darr[0] += 1.0; + darr[1] += 1.0; + } +} + +// CK9: define internal void [[KERNEL]]([2 x double]* {{.+}}[[ARG:%.+]]) +// CK9: [[ADDR:%.+]] = alloca [2 x double]*, +// CK9: store [2 x double]* [[ARG]], [2 x double]** [[ADDR]], +// CK9: [[REF:%.+]] = load [2 x double]*, [2 x double]** [[ADDR]], +// CK9: {{.+}} = getelementptr inbounds [2 x double], [2 x double]* [[REF]], i{{64|32}} 0, i{{64|32}} 0 +#endif // CK9 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_09.cpp b/clang/test/OpenMP/target_map_codegen_09.cpp new file mode 100644 index 00000000000000..e689cb062c6089 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_09.cpp @@ -0,0 +1,71 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 +// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 +// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 +// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 + +// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 +// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 +// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 +// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 + +// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 +// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 +// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 +// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 + +// RUN: %clang_cc1 -DCK10 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s +// RUN: %clang_cc1 -DCK10 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s +// RUN: %clang_cc1 -DCK10 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s +// RUN: %clang_cc1 -DCK10 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s +// SIMD-ONLY9-NOT: {{__kmpc|__tgt}} +#ifdef CK10 + +// CK10-LABEL: @.__omp_offloading_{{.*}}implicit_maps_pointer{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 + +// CK10-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] zeroinitializer +// Map types: OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 544 +// CK10-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 544] + +// CK10-LABEL: implicit_maps_pointer{{.*}}( +void implicit_maps_pointer (){ + double *ddyn; + + // CK10-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK10-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK10-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK10-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK10-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK10-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double** + // CK10-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double** + // CK10-DAG: store double* [[PTR:%[^,]+]], double** [[CBP1]] + // CK10-DAG: store double* [[PTR]], double** [[CP1]] + + // CK10: call void [[KERNEL:@.+]](double* [[PTR]]) + #pragma omp target + { + ddyn[0] += 1.0; + ddyn[1] += 1.0; + } +} + +// CK10: define internal void [[KERNEL]](double* {{.*}}[[ARG:%.+]]) +// CK10: [[ADDR:%.+]] = alloca double*, +// CK10: store double* [[ARG]], double** [[ADDR]], +// CK10: [[REF:%.+]] = load double*, double** [[ADDR]], +// CK10: {{.+}} = getelementptr inbounds double, double* [[REF]], i{{64|32}} 0 + +#endif // CK10 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_10.cpp b/clang/test/OpenMP/target_map_codegen_10.cpp new file mode 100644 index 00000000000000..c1eb443b62a645 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_10.cpp @@ -0,0 +1,55 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11 +// RUN: %clang_cc1 -DCK11 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11 +// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11 +// RUN: %clang_cc1 -DCK11 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11 + +// RUN: %clang_cc1 -DCK11 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// RUN: %clang_cc1 -DCK11 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// RUN: %clang_cc1 -DCK11 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// RUN: %clang_cc1 -DCK11 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// SIMD-ONLY10-NOT: {{__kmpc|__tgt}} +#ifdef CK11 + +// CK11-LABEL: @.__omp_offloading_{{.*}}implicit_maps_double_complex{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 + +// CK11-DAG: [[SIZES:@.+]] = {{.+}}constant [2 x i64] [i64 16, i64 {{8|4}}] +// Map types: OMP_MAP_TO | OMP_MAP_FROM | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547 +// CK11-DAG: [[TYPES:@.+]] = {{.+}}constant [2 x i64] [i64 547, i64 547] + +// CK11-LABEL: implicit_maps_double_complex{{.*}}( +void implicit_maps_double_complex (int a, int *b){ + double _Complex dc = (double)a; + + // CK11-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK11-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK11-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK11-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK11-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK11-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to { double, double }** + // CK11-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to { double, double }** + // CK11-DAG: store { double, double }* [[PTR:%[^,]+]], { double, double }** [[CBP1]] + // CK11-DAG: store { double, double }* [[PTR]], { double, double }** [[CP1]] + + // CK11: call void [[KERNEL:@.+]]({ double, double }* [[PTR]], i32** %{{.+}}) + #pragma omp target defaultmap(tofrom:scalar) + { + dc *= dc; *b = 1; + } +} + +// CK11: define internal void [[KERNEL]]({ double, double }* {{.*}}[[ARG:%.+]], i32** {{.*}}) +// CK11: [[ADDR:%.+]] = alloca { double, double }*, +// CK11: store { double, double }* [[ARG]], { double, double }** [[ADDR]], +// CK11: [[REF:%.+]] = load { double, double }*, { double, double }** [[ADDR]], +// CK11: {{.+}} = getelementptr inbounds { double, double }, { double, double }* [[REF]], i32 0, i32 0 +#endif // CK11 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_11.cpp b/clang/test/OpenMP/target_map_codegen_11.cpp new file mode 100644 index 00000000000000..1210d798a021de --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_11.cpp @@ -0,0 +1,90 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-64 +// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-64 +// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-32 +// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-32 + +// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-64 +// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-64 +// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-32 +// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-32 + +// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-64 +// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-64 +// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-32 +// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-32 + +// RUN: %clang_cc1 -DCK12 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY11 %s +// RUN: %clang_cc1 -DCK12 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY11 %s +// RUN: %clang_cc1 -DCK12 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY11 %s +// RUN: %clang_cc1 -DCK12 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY11 %s +// SIMD-ONLY11-NOT: {{__kmpc|__tgt}} +#ifdef CK12 + +// For a 32-bit targets, the value doesn't fit the size of the pointer, +// therefore it is passed by reference with a map 'to' specification. + +// CK12-LABEL: @.__omp_offloading_{{.*}}implicit_maps_float_complex{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 + +// CK12-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] +// Map types: OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK12-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] +// Map types: OMP_MAP_TO | OMP_MAP_PRIVATE | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 673 +// CK12-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 673] + +// CK12-LABEL: implicit_maps_float_complex{{.*}}( +void implicit_maps_float_complex (int a){ + float _Complex fc = (float)a; + + // CK12-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK12-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK12-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK12-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK12-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + + // CK12-64-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* + // CK12-64-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* + // CK12-64-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] + // CK12-64-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] + // CK12-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK12-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }* + // CK12-64-DAG: store { float, float } {{.+}}, { float, float }* [[CADDR]], + + // CK12-32-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to { float, float }** + // CK12-32-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to { float, float }** + // CK12-32-DAG: store { float, float }* [[DECL:%[^,]+]], { float, float }** [[CBP1]] + // CK12-32-DAG: store { float, float }* [[DECL]], { float, float }** [[CP1]] + + // CK12-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) + // CK12-32: call void [[KERNEL:@.+]]({ float, float }* [[DECL]]) + #pragma omp target + { + fc *= fc; + } +} + +// CK12-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) +// CK12-64: [[ADDR:%.+]] = alloca i[[sz]], +// CK12-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], +// CK12-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }* +// CK12-64: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[CADDR]], i32 0, i32 0 + +// CK12-32: define internal void [[KERNEL]]({ float, float }* {{.+}}[[ARG:%.+]]) +// CK12-32: [[ADDR:%.+]] = alloca { float, float }*, +// CK12-32: store { float, float }* [[ARG]], { float, float }** [[ADDR]], +// CK12-32: [[REF:%.+]] = load { float, float }*, { float, float }** [[ADDR]], +// CK12-32: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[REF]], i32 0, i32 0 +#endif // CK12 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_12.cpp b/clang/test/OpenMP/target_map_codegen_12.cpp new file mode 100644 index 00000000000000..86a21b14334faa --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_12.cpp @@ -0,0 +1,101 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 +// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 +// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 +// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 + +// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 +// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 +// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 +// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 + +// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 +// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 +// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 +// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 + +// RUN: %clang_cc1 -DCK13 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s +// RUN: %clang_cc1 -DCK13 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s +// RUN: %clang_cc1 -DCK13 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s +// RUN: %clang_cc1 -DCK13 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s +// SIMD-ONLY12-NOT: {{__kmpc|__tgt}} +#ifdef CK13 + +// CK13-LABEL: @.__omp_offloading_{{.*}}implicit_maps_variable_length_array{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 + +// We don't have a constant map size for VLAs. +// Map types: +// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM + OMP_MAP_IMPLICIT = 800 (vla size) +// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM + OMP_MAP_IMPLICIT = 800 (vla size) +// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547 +// CK13-DAG: [[TYPES:@.+]] = {{.+}}constant [3 x i64] [i64 800, i64 800, i64 547] + +// CK13-LABEL: implicit_maps_variable_length_array{{.*}}( +void implicit_maps_variable_length_array (int a){ + double vla[2][a]; + + // CK13-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 3, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i64* [[SGEP:%[^,]+]], {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK13-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK13-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK13-DAG: [[SGEP]] = getelementptr inbounds {{.+}}[[SS:%[^,]+]], i32 0, i32 0 + + // CK13-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK13-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK13-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 0 + // CK13-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[sz:64|32]]* + // CK13-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[sz]]* + // CK13-DAG: store i[[sz]] 2, i[[sz]]* [[CBP0]] + // CK13-DAG: store i[[sz]] 2, i[[sz]]* [[CP0]] + // CK13-DAG: store i64 {{8|4}}, i64* [[S0]], + + // CK13-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1 + // CK13-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1 + // CK13-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 1 + // CK13-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]* + // CK13-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* + // CK13-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]] + // CK13-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] + // CK13-DAG: store i64 {{8|4}}, i64* [[S1]], + + // CK13-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2 + // CK13-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2 + // CK13-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 2 + // CK13-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double** + // CK13-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** + // CK13-DAG: store double* [[DECL:%.+]], double** [[CBP2]] + // CK13-DAG: store double* [[DECL]], double** [[CP2]] + // CK13-DAG: store i64 [[VALS2:%.+]], i64* [[S2]], + // CK13-DAG: [[VALS2]] = {{mul nuw i64 %.+, 8|sext i32 %.+ to i64}} + + // CK13: call void [[KERNEL:@.+]](i[[sz]] {{.+}}, i[[sz]] {{.+}}, double* [[DECL]]) + #pragma omp target + { + vla[1][3] += 1.0; + } +} + +// CK13: define internal void [[KERNEL]](i[[sz]] [[VLA0:%.+]], i[[sz]] [[VLA1:%.+]], double* {{.*}}[[ARG:%.+]]) +// CK13: [[ADDR0:%.+]] = alloca i[[sz]], +// CK13: [[ADDR1:%.+]] = alloca i[[sz]], +// CK13: [[ADDR2:%.+]] = alloca double*, +// CK13: store i[[sz]] [[VLA0]], i[[sz]]* [[ADDR0]], +// CK13: store i[[sz]] [[VLA1]], i[[sz]]* [[ADDR1]], +// CK13: store double* [[ARG]], double** [[ADDR2]], +// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR0]], +// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR1]], +// CK13: [[REF:%.+]] = load double*, double** [[ADDR2]], +// CK13: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] %{{.+}} +#endif // CK13 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_13.cpp b/clang/test/OpenMP/target_map_codegen_13.cpp new file mode 100644 index 00000000000000..feb1c51a94b691 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_13.cpp @@ -0,0 +1,128 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-64 +// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-64 +// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-32 +// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-32 + +// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-64 +// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-64 +// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-32 +// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-32 + +// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-64 +// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-64 +// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-32 +// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-32 + +// RUN: %clang_cc1 -DCK14 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY13 %s +// RUN: %clang_cc1 -DCK14 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY13 %s +// RUN: %clang_cc1 -DCK14 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY13 %s +// RUN: %clang_cc1 -DCK14 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY13 %s +// SIMD-ONLY13-NOT: {{__kmpc|__tgt}} +#ifdef CK14 + +// CK14-DAG: [[ST:%.+]] = type { i32, double } + +// CK14-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 + + +// Map types: +// - OMP_MAP_TARGET_PARAM = 32 +// - OMP_MAP_TO + OMP_MAP_FROM | OMP_MAP_IMPLICIT | OMP_MAP_MEMBER_OF = 281474976711171 +// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK14-DAG: [[TYPES:@.+]] = {{.+}}constant [4 x i64] [i64 32, i64 281474976711171, i64 281474976711171, i64 800] + +class SSS { +public: + int a; + double b; + + void foo(int c) { + #pragma omp target + { + a += c; + b += (double)c; + } + } + + SSS(int a, double b) : a(a), b(b) {} +}; + +// CK14-LABEL: implicit_maps_class{{.*}}( +void implicit_maps_class (int a){ + SSS sss(a, (double)a); + + // CK14: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}}) + // CK14-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 4, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i64* [[SIZES:%[^,]+]], {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK14-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK14-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK14-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]], i32 0, i32 0 + + // CK14-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK14-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK14-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 0 + // CK14-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** + // CK14-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK14-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]] + // CK14-DAG: store i32* [[A:%.+]], i32** [[CP0]] + // CK14-DAG: store i64 %{{.+}}, i64* [[S0]] + + // CK14-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1 + // CK14-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1 + // CK14-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 1 + // CK14-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** + // CK14-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK14-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP1]] + // CK14-DAG: store i32* [[A]], i32** [[CP1]] + // CK14-DAG: store i64 4, i64* [[S1]] + + // CK14-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2 + // CK14-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2 + // CK14-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 2 + // CK14-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]** + // CK14-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** + // CK14-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP2]] + // CK14-DAG: store double* %{{.+}}, double** [[CP2]] + // CK14-DAG: store i64 8, i64* [[S2]] + + // CK14-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 3 + // CK14-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 3 + // CK14-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 3 + // CK14-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to i[[sz:64|32]]* + // CK14-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i[[sz]]* + // CK14-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP3]] + // CK14-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP3]] + // CK14-DAG: store i64 4, i64* [[S3]] + // CK14-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK14-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* + // CK14-64-DAG: store i32 {{.+}}, i32* [[CADDR]], + + // CK14: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}}) + sss.foo(123); +} + +// CK14: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]]) +// CK14: [[ADDR0:%.+]] = alloca [[ST]]*, +// CK14: [[ADDR1:%.+]] = alloca i[[sz]], +// CK14: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]], +// CK14: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]], +// CK14: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]], +// CK14-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32* +// CK14-64: {{.+}} = load i32, i32* [[CADDR1]], +// CK14-32: {{.+}} = load i32, i32* [[ADDR1]], +// CK14: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0 + +#endif // CK14 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_14.cpp b/clang/test/OpenMP/target_map_codegen_14.cpp new file mode 100644 index 00000000000000..73425c8c51c472 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_14.cpp @@ -0,0 +1,198 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-64 +// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-64 +// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-32 +// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-32 + +// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-64 +// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-64 +// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-32 +// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-32 + +// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-64 +// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-64 +// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-32 +// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-32 + +// RUN: %clang_cc1 -DCK15 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY14 %s +// RUN: %clang_cc1 -DCK15 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY14 %s +// RUN: %clang_cc1 -DCK15 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY14 %s +// RUN: %clang_cc1 -DCK15 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY14 %s +// SIMD-ONLY14-NOT: {{__kmpc|__tgt}} +#ifdef CK15 + +// CK15: [[ST:%.+]] = type { i32, double } +// Map types: +// - OMP_MAP_TARGET_PARAM = 32 +// - OMP_MAP_TO + OMP_MAP_FROM | OMP_MAP_IMPLICIT | OMP_MAP_MEMBER_OF = 281474976711171 +// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK15: [[TYPES:@.+]] = {{.+}}constant [4 x i64] [i64 32, i64 281474976711171, i64 281474976711171, i64 800] + +// Map types: +// - OMP_MAP_TARGET_PARAM = 32 +// - OMP_MAP_TO + OMP_MAP_FROM | OMP_MAP_IMPLICIT | OMP_MAP_MEMBER_OF = 281474976711171 +// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK15: [[TYPES2:@.+]] = {{.+}}constant [4 x i64] [i64 32, i64 281474976711171, i64 281474976711171, i64 800] + +template +class SSST { +public: + int a; + double b; + + void foo(int c) { + #pragma omp target + { + a += c + x; + b += (double)(c + x); + } + } + template + void bar(int c) { + #pragma omp target + { + a += c + x + y; + b += (double)(c + x + y); + } + } + + SSST(int a, double b) : a(a), b(b) {} +}; + +// CK15-LABEL: implicit_maps_templated_class{{.*}}( +void implicit_maps_templated_class (int a){ + SSST<123> ssst(a, (double)a); + + // CK15: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}}) + // CK15-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 4, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i64* [[SIZES:%[^,]+]], {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK15-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]], i32 0, i32 0 + + // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK15-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 0 + // CK15-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** + // CK15-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK15-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]] + // CK15-DAG: store i32* [[A:%.+]], i32** [[CP0]] + // CK15-DAG: store i64 %{{.+}}, i64* [[S0]] + + // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1 + // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1 + // CK15-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 1 + // CK15-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** + // CK15-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP1]] + // CK15-DAG: store i32* [[A]], i32** [[CP1]] + // CK15-DAG: store i64 4, i64* [[S1]] + + // CK15-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2 + // CK15-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2 + // CK15-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 2 + // CK15-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]** + // CK15-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** + // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP2]] + // CK15-DAG: store double* %{{.+}}, double** [[CP2]] + // CK15-DAG: store i64 8, i64* [[S2]] + + // CK15-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 3 + // CK15-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 3 + // CK15-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 3 + // CK15-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to i[[sz:64|32]]* + // CK15-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i[[sz]]* + // CK15-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP3]] + // CK15-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP3]] + // CK15-DAG: store i64 4, i64* [[S3]] + // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* + // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]], + + // CK15: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}}) + ssst.foo(456); + + // CK15: define {{.*}}void @{{.+}}bar{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}}) + // CK15-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 4, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i64* [[SIZES:[^,]+]], {{.+}}[[TYPES2]]{{.+}}, i8** null) + // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK15-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]], i32 0, i32 0 + + // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK15-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 0 + // CK15-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** + // CK15-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK15-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]] + // CK15-DAG: store i32* [[A:%.+]], i32** [[CP0]] + // CK15-DAG: store i64 %{{.+}}, i64* [[S0]] + + // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1 + // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1 + // CK15-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 1 + // CK15-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** + // CK15-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP1]] + // CK15-DAG: store i32* [[A]], i32** [[CP1]] + // CK15-DAG: store i64 4, i64* [[S1]] + + // CK15-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2 + // CK15-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2 + // CK15-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 2 + // CK15-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]** + // CK15-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** + // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP2]] + // CK15-DAG: store double* %{{.+}}, double** [[CP2]] + // CK15-DAG: store i64 8, i64* [[S2]] + + // CK15-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 3 + // CK15-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 3 + // CK15-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 3 + // CK15-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to i[[sz]]* + // CK15-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i[[sz]]* + // CK15-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP3]] + // CK15-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP3]] + // CK15-DAG: store i64 4, i64* [[S3]] + // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* + // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]], + + // CK15: call void [[KERNEL2:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}}) + ssst.bar<210>(789); +} + +// CK15: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]]) +// CK15: [[ADDR0:%.+]] = alloca [[ST]]*, +// CK15: [[ADDR1:%.+]] = alloca i[[sz]], +// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]], +// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]], +// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]], +// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32* +// CK15-64: {{.+}} = load i32, i32* [[CADDR1]], +// CK15-32: {{.+}} = load i32, i32* [[ADDR1]], +// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0 + +// CK15: define internal void [[KERNEL2]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]]) +// CK15: [[ADDR0:%.+]] = alloca [[ST]]*, +// CK15: [[ADDR1:%.+]] = alloca i[[sz]], +// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]], +// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]], +// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]], +// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32* +// CK15-64: {{.+}} = load i32, i32* [[CADDR1]], +// CK15-32: {{.+}} = load i32, i32* [[ADDR1]], +// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0 + +#endif // CK15 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_15.cpp b/clang/test/OpenMP/target_map_codegen_15.cpp new file mode 100644 index 00000000000000..ad409af4349112 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_15.cpp @@ -0,0 +1,80 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-64 +// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-64 +// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-32 +// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-32 + +// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-64 +// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-64 +// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-32 +// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-32 + +// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-64 +// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-64 +// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-32 +// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-32 + +// RUN: %clang_cc1 -DCK16 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY15 %s +// RUN: %clang_cc1 -DCK16 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY15 %s +// RUN: %clang_cc1 -DCK16 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY15 %s +// RUN: %clang_cc1 -DCK16 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY15 %s +// SIMD-ONLY15-NOT: {{__kmpc|__tgt}} +#ifdef CK16 + +// CK16-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] +// Map types: +// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK16-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] + +template +int foo(int d) { + int res = d; + #pragma omp target + { + res += y; + } + return res; +} +// CK16-LABEL: implicit_maps_templated_function{{.*}}( +void implicit_maps_templated_function (int a){ + int i = a; + + // CK16: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}}) + // CK16-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK16-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK16-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + + // CK16-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK16-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK16-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* + // CK16-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* + // CK16-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]] + // CK16-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] + // CK16-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK16-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* + // CK16-64-DAG: store i32 {{.+}}, i32* [[CADDR]], + + // CK16: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) + i = foo<543>(i); +} +// CK16: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) +// CK16: [[ADDR:%.+]] = alloca i[[sz]], +// CK16: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], +// CK16-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32* +// CK16-64: {{.+}} = load i32, i32* [[CADDR]], +// CK16-32: {{.+}} = load i32, i32* [[ADDR]], + +#endif // CK16 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_16.cpp b/clang/test/OpenMP/target_map_codegen_16.cpp new file mode 100644 index 00000000000000..054874be06042b --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_16.cpp @@ -0,0 +1,76 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 +// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 +// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 +// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 + +// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 +// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 +// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 +// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 + +// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 +// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 +// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 +// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 + +// RUN: %clang_cc1 -DCK17 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK17 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK17 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK17 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// SIMD-ONLY16-NOT: {{__kmpc|__tgt}} +#ifdef CK17 + +// CK17-DAG: [[ST:%.+]] = type { i32, double } +// CK17-LABEL: @.__omp_offloading_{{.*}}implicit_maps_struct{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK17-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 {{16|12}}] +// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547 +// CK17-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 547] + +class SSS { +public: + int a; + double b; +}; + +// CK17-LABEL: implicit_maps_struct{{.*}}( +void implicit_maps_struct (int a){ + SSS s = {a, (double)a}; + + // CK17-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK17-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK17-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK17-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK17-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK17-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** + // CK17-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[ST]]** + // CK17-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP1]] + // CK17-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CP1]] + + // CK17: call void [[KERNEL:@.+]]([[ST]]* [[DECL]]) + #pragma omp target + { + s.a += 1; + s.b += 1.0; + } +} + +// CK17: define internal void [[KERNEL]]([[ST]]* {{.+}}[[ARG:%.+]]) +// CK17: [[ADDR:%.+]] = alloca [[ST]]*, +// CK17: store [[ST]]* [[ARG]], [[ST]]** [[ADDR]], +// CK17: [[REF:%.+]] = load [[ST]]*, [[ST]]** [[ADDR]], +// CK17: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF]], i32 0, i32 0 +#endif // CK17 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_17.cpp b/clang/test/OpenMP/target_map_codegen_17.cpp new file mode 100644 index 00000000000000..e6141053842b73 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_17.cpp @@ -0,0 +1,79 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-64 +// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-64 +// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-32 +// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-32 + +// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-64 +// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-64 +// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-32 +// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-32 + +// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-64 +// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-64 +// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-32 +// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-32 + +// RUN: %clang_cc1 -DCK18 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY17 %s +// RUN: %clang_cc1 -DCK18 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY17 %s +// RUN: %clang_cc1 -DCK18 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY17 %s +// RUN: %clang_cc1 -DCK18 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY17 %s +// SIMD-ONLY17-NOT: {{__kmpc|__tgt}} +#ifdef CK18 + +// CK18-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4] +// Map types: +// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK18-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] + +template +int foo(T d) { + #pragma omp target + { + d += (T)1; + } + return d; +} +// CK18-LABEL: implicit_maps_template_type_capture{{.*}}( +void implicit_maps_template_type_capture (int a){ + int i = a; + + // CK18: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}}) + // CK18-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null) + // CK18-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK18-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + + // CK18-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK18-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK18-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* + // CK18-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* + // CK18-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]] + // CK18-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] + // CK18-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK18-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32* + // CK18-64-DAG: store i32 {{.+}}, i32* [[CADDR]], + + // CK18: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) + i = foo(i); +} +// CK18: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) +// CK18: [[ADDR:%.+]] = alloca i[[sz]], +// CK18: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], +// CK18-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32* +// CK18-64: {{.+}} = load i32, i32* [[CADDR]], +// CK18-32: {{.+}} = load i32, i32* [[ADDR]], + +#endif // CK18 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_18.cpp b/clang/test/OpenMP/target_map_codegen_18.cpp new file mode 100644 index 00000000000000..201684f32f525f --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_18.cpp @@ -0,0 +1,1840 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-USE +// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-USE +// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-USE +// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-USE + +// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-USE +// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-USE +// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-USE +// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-USE + +// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-USE +// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-USE +// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-USE +// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-USE + +// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DUSE -DCK19 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DUSE -DCK19 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s + +// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-NOUSE +// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-NOUSE +// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-NOUSE +// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-NOUSE + +// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-NOUSE +// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-NOUSE +// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-NOUSE +// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-NOUSE + +// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-NOUSE +// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-64,CK19-NOUSE +// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-NOUSE +// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK19,CK19-32,CK19-NOUSE + +// RUN: %clang_cc1 -DCK19 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DCK19 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DCK19 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DCK19 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s + + +// SIMD-ONLY18-NOT: {{__kmpc|__tgt}} +#ifdef CK19 + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK19: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 32] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE00n:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK19: [[MTYPE00n:@.+]] = private {{.*}}constant [1 x i64] [i64 32] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 400] +// CK19: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 33] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE02:@.+]] = private {{.*}}constant [1 x i64] [i64 240] +// CK19: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 34] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE03:@.+]] = private {{.*}}constant [1 x i64] [i64 240] +// CK19: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE04:@.+]] = private {{.*}}constant [1 x i64] [i64 400] +// CK19: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 32] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE05:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK19: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 33] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i64] [i64 32] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE08:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK19: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE09:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] +// CK19: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 34] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE10:@.+]] = private {{.*}}constant [1 x i64] [i64 240] +// CK19: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE11:@.+]] = private {{.*}}constant [1 x i64] [i64 240] +// CK19: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i64] [i64 32] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE12:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK19: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i64] [i64 33] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i64] [i64 32] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i64] [i64 33] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE15:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK19: [[MTYPE15:@.+]] = private {{.*}}constant [1 x i64] [i64 34] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19-USE: [[MTYPE16:@.+]] = private {{.*}}constant [2 x i64] [i64 800, i64 33] +// CK19-NOUSE: [[MTYPE16:@.+]] = private {{.*}}constant [1 x i64] [i64 33] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19-USE: [[SIZE17:@.+]] = private {{.*}}constant [2 x i64] [i64 {{8|4}}, i64 240] +// CK19-USE: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i64] [i64 800, i64 34] +// CK19-NOUSE: [[SIZE17:@.+]] = private {{.*}}constant [1 x i64] [i64 240] +// CK19-NOUSE: [[MTYPE17:@.+]] = private {{.*}}constant [1 x i64] [i64 34] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19-USE: [[SIZE18:@.+]] = private {{.*}}constant [2 x i64] [i64 {{8|4}}, i64 240] +// CK19-USE: [[MTYPE18:@.+]] = private {{.*}}constant [2 x i64] [i64 800, i64 35] +// CK19-NOUSE: [[SIZE18:@.+]] = private {{.*}}constant [1 x i64] [i64 240] +// CK19-NOUSE: [[MTYPE18:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19-USE: [[MTYPE19:@.+]] = private {{.*}}constant [2 x i64] [i64 800, i64 32] +// CK19-NOUSE: [[MTYPE19:@.+]] = private {{.*}}constant [1 x i64] [i64 32] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19-USE: [[SIZE20:@.+]] = private {{.*}}constant [2 x i64] [i64 {{8|4}}, i64 4] +// CK19-USE: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i64] [i64 800, i64 33] +// CK19-NOUSE: [[SIZE20:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK19-NOUSE: [[MTYPE20:@.+]] = private {{.*}}constant [1 x i64] [i64 33] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19-USE: [[MTYPE21:@.+]] = private {{.*}}constant [2 x i64] [i64 800, i64 35] +// CK19-NOUSE: [[MTYPE21:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19-USE: [[SIZE22:@.+]] = private {{.*}}constant [2 x i64] [i64 {{8|4}}, i64 4] +// CK19-USE: [[MTYPE22:@.+]] = private {{.*}}constant [2 x i64] [i64 800, i64 35] +// CK19-NOUSE: [[SIZE22:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK19-NOUSE: [[MTYPE22:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE23:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK19: [[MTYPE23:@.+]] = private {{.*}}constant [1 x i64] [i64 39] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE24:@.+]] = private {{.*}}constant [1 x i64] [i64 480] +// CK19: [[MTYPE24:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE25:@.+]] = private {{.*}}constant [1 x i64] [i64 16] +// CK19: [[MTYPE25:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE26:@.+]] = private {{.*}}constant [1 x i64] [i64 24] +// CK19: [[MTYPE26:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE27:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK19: [[MTYPE27:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE28:@.+]] = private {{.*}}constant [3 x i64] [i64 {{8|4}}, i64 {{8|4}}, i64 16] +// CK19: [[MTYPE28:@.+]] = private {{.*}}constant [3 x i64] [i64 35, i64 16, i64 19] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE29:@.+]] = private {{.*}}constant [3 x i64] [i64 {{8|4}}, i64 {{8|4}}, i64 4] +// CK19: [[MTYPE29:@.+]] = private {{.*}}constant [3 x i64] [i64 35, i64 16, i64 19] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19-USE: [[MTYPE30:@.+]] = private {{.*}}constant [4 x i64] [i64 800, i64 800, i64 800, i64 35] +// CK19-NOUSE: [[MTYPE30:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19-USE: [[SIZE31:@.+]] = private {{.*}}constant [4 x i64] [i64 {{8|4}}, i64 {{8|4}}, i64 {{8|4}}, i64 40] +// CK19-USE: [[MTYPE31:@.+]] = private {{.*}}constant [4 x i64] [i64 800, i64 800, i64 800, i64 35] +// CK19-NOUSE: [[SIZE31:@.+]] = private {{.*}}constant [1 x i64] [i64 40] +// CK19-NOUSE: [[MTYPE31:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE32:@.+]] = private {{.*}}constant [1 x i64] [i64 13728] +// CK19: [[MTYPE32:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE33:@.+]] = private {{.*}}constant [1 x i64] [i64 13728] +// CK19: [[MTYPE33:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE34:@.+]] = private {{.*}}constant [1 x i64] [i64 13728] +// CK19: [[MTYPE34:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[MTYPE35:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE36:@.+]] = private {{.*}}constant [1 x i64] [i64 208] +// CK19: [[MTYPE36:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19-USE: [[MTYPE37:@.+]] = private {{.*}}constant [3 x i64] [i64 800, i64 800, i64 35] +// CK19-NOUSE: [[MTYPE37:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19-USE: [[MTYPE38:@.+]] = private {{.*}}constant [3 x i64] [i64 800, i64 800, i64 35] +// CK19-NOUSE: [[MTYPE38:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19-USE: [[MTYPE39:@.+]] = private {{.*}}constant [3 x i64] [i64 800, i64 800, i64 35] +// CK19-NOUSE: [[MTYPE39:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19-USE: [[MTYPE40:@.+]] = private {{.*}}constant [3 x i64] [i64 800, i64 800, i64 35] +// CK19-NOUSE: [[MTYPE40:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19-USE: [[SIZE41:@.+]] = private {{.*}}constant [3 x i64] [i64 {{8|4}}, i64 {{8|4}}, i64 208] +// CK19-USE: [[MTYPE41:@.+]] = private {{.*}}constant [3 x i64] [i64 800, i64 800, i64 35] +// CK19-NOUSE: [[SIZE41:@.+]] = private {{.*}}constant [1 x i64] [i64 208] +// CK19-NOUSE: [[MTYPE41:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE42:@.+]] = private {{.*}}constant [3 x i64] [i64 {{8|4}}, i64 {{8|4}}, i64 104] +// CK19: [[MTYPE42:@.+]] = private {{.*}}constant [3 x i64] [i64 35, i64 16, i64 19] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[MTYPE43:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK19: [[SIZE44:@.+]] = private {{.*}}constant [1 x i64] [i64 320] +// CK19: [[MTYPE44:@.+]] = private {{.*}}constant [1 x i64] [i64 34] + +// CK19-LABEL: explicit_maps_single{{.*}}( +void explicit_maps_single (int ii){ + // Map of a scalar. + int a = ii; + + // Region 00 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]] + + // CK19-USE: call void [[CALL00:@.+]](i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL00:@.+]]() + #pragma omp target map(alloc:a) + { +#ifdef USE + ++a; +#endif + } + + // Map of a scalar in nested region. + int b = a; + + // Region 00n + // CK19-DAG: call i32 @__tgt_target_teams_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00n]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00n]]{{.+}}, i8** null, i32 1, i32 0) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]] + + // CK19-USE: call void [[CALL00n:@.+]](i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL00n:@.+]]() + #pragma omp target map(alloc:b) + #pragma omp parallel + { +#ifdef USE + ++b; +#endif + } + + // Map of an array. + int arra[100]; + + // Region 01 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x i32]** + // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] + // CK19-DAG: store [100 x i32]* [[VAR0]], [100 x i32]** [[CP0]] + + // CK19-USE: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL01:@.+]]() + #pragma omp target map(to:arra) + { +#ifdef USE + arra[50]++; +#endif + } + + // Region 02 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 20 + + // CK19-USE: call void [[CALL02:@.+]]([100 x i32]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL02:@.+]]() + #pragma omp target map(from:arra[20:60]) + { +#ifdef USE + arra[50]++; +#endif + } + + // Region 03 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0 + + // CK19-USE: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL03:@.+]]() + #pragma omp target map(tofrom:arra[:60]) + { +#ifdef USE + arra[50]++; +#endif + } + + // Region 04 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0 + + // CK19-USE: call void [[CALL04:@.+]]([100 x i32]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL04:@.+]]() + #pragma omp target map(alloc:arra[:]) + { +#ifdef USE + arra[50]++; +#endif + } + + // Region 05 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 15 + + // CK19-USE: call void [[CALL05:@.+]]([100 x i32]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL05:@.+]]() + #pragma omp target map(to:arra[15]) + { +#ifdef USE + arra[15]++; +#endif + } + + // Region 06 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] + // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]] + // CK19-DAG: [[CSVAL0]] = {{mul nuw i.+ %.*, 4|sext i32 .+ to i64}} + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}} + + // CK19-USE: call void [[CALL06:@.+]]([100 x i32]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL06:@.+]]() + #pragma omp target map(tofrom:arra[ii:ii+23]) + { +#ifdef USE + arra[50]++; +#endif + } + + // Region 07 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] + // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]] + // CK19-DAG: [[CSVAL0]] = {{mul nuw i.+ %.*, 4|sext i32 .+ to i64}} + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0 + + // CK19-USE: call void [[CALL07:@.+]]([100 x i32]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL07:@.+]]() + #pragma omp target map(alloc:arra[:ii]) + { +#ifdef USE + arra[50]++; +#endif + } + + // Region 08 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}} + + // CK19-USE: call void [[CALL08:@.+]]([100 x i32]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL08:@.+]]() + #pragma omp target map(tofrom:arra[ii]) + { +#ifdef USE + arra[15]++; +#endif + } + + // Map of a pointer. + int *pa; + + // Region 09 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32*** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32*** + // CK19-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]] + // CK19-DAG: store i32** [[VAR0]], i32*** [[CP0]] + + // CK19-USE: call void [[CALL09:@.+]](i32** {{[^,]+}}) + // CK19-NOUSE: call void [[CALL09:@.+]]() + #pragma omp target map(from:pa) + { +#ifdef USE + pa[50]++; +#endif + } + + // Region 10 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 20 + // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] + + // CK19-USE: call void [[CALL10:@.+]](i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL10:@.+]]() + #pragma omp target map(tofrom:pa[20:60]) + { +#ifdef USE + pa[50]++; +#endif + } + + // Region 11 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0 + // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] + + // CK19-USE: call void [[CALL11:@.+]](i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL11:@.+]]() + #pragma omp target map(alloc:pa[:60]) + { +#ifdef USE + pa[50]++; +#endif + } + + // Region 12 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 15 + // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] + + // CK19-USE: call void [[CALL12:@.+]](i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL12:@.+]]() + #pragma omp target map(to:pa[15]) + { +#ifdef USE + pa[15]++; +#endif + } + + // Region 13 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]] + // CK19-DAG: [[CSVAL0]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} + // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}} + // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] + + // CK19-USE: call void [[CALL13:@.+]](i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL13:@.+]]() + #pragma omp target map(alloc:pa[ii-23:ii]) + { +#ifdef USE + pa[50]++; +#endif + } + + // Region 14 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]] + // CK19-DAG: [[CSVAL0]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} + // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0 + // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] + + // CK19-USE: call void [[CALL14:@.+]](i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL14:@.+]]() + #pragma omp target map(to:pa[:ii]) + { +#ifdef USE + pa[50]++; +#endif + } + + // Region 15 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE15]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE15]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}} + // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] + + // CK19-USE: call void [[CALL15:@.+]](i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL15:@.+]]() + #pragma omp target map(from:pa[ii+12]) + { +#ifdef USE + pa[15]++; +#endif + } + + // Map of a variable-size array. + int va[ii]; + + // Region 16 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|2}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[MTYPE16]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z:64|32]]* + // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]] + // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]] + // CK19-USE-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]] + + // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** + // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK19-USE-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] + // CK19-USE-DAG: store i32* [[VAR1]], i32** [[CP1]] + // CK19-USE-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]] + // CK19-USE-DAG: [[CSVAL1]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} + + // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-NOUSE-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK19-NOUSE-DAG: store i32* [[VAR0]], i32** [[CP0]] + // CK19-NOUSE-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]] + // CK19-NOUSE-DAG: [[CSVAL0]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} + + // CK19-USE: call void [[CALL16:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL16:@.+]]() + #pragma omp target map(to:va) + { +#ifdef USE + va[50]++; +#endif + } + + // Region 17 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|2}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[SIZE17]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[MTYPE17]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* + // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]] + // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]] + + // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** + // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK19-USE-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] + // CK19-USE-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] + // CK19-USE-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 20 + + // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-NOUSE-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK19-NOUSE-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[VAR0]], i{{.+}} 20 + + // CK19-USE: call void [[CALL17:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL17:@.+]]() + #pragma omp target map(from:va[20:60]) + { +#ifdef USE + va[50]++; +#endif + } + + // Region 18 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|2}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[SIZE18]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[MTYPE18]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* + // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]] + // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]] + + // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** + // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK19-USE-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] + // CK19-USE-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] + // CK19-USE-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0 + + // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-NOUSE-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK19-NOUSE-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[VAR0]], i{{.+}} 0 + + // CK19-USE: call void [[CALL18:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL18:@.+]]() + #pragma omp target map(tofrom:va[:60]) + { +#ifdef USE + va[50]++; +#endif + } + + // Region 19 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|2}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[MTYPE19]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* + // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]] + // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]] + // CK19-USE-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]] + + // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** + // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK19-USE-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] + // CK19-USE-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] + // CK19-USE-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]] + // CK19-USE-DAG: [[CSVAL1]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} + // CK19-USE-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0 + + // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-NOUSE-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK19-NOUSE-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK19-NOUSE-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]] + // CK19-NOUSE-DAG: [[CSVAL0]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} + // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[VAR0]], i{{.+}} 0 + + // CK19-USE: call void [[CALL19:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL19:@.+]]() + #pragma omp target map(alloc:va[:]) + { +#ifdef USE + va[50]++; +#endif + } + + // Region 20 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|2}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[SIZE20]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[MTYPE20]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* + // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]] + // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]] + + // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** + // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK19-USE-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] + // CK19-USE-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] + // CK19-USE-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 15 + + // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-NOUSE-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK19-NOUSE-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[VAR0]], i{{.+}} 15 + + // CK19-USE: call void [[CALL20:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL20:@.+]]() + #pragma omp target map(to:va[15]) + { +#ifdef USE + va[15]++; +#endif + } + + // Region 21 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|2}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[MTYPE21]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* + // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]] + // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]] + // CK19-USE-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]] + + // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** + // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK19-USE-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] + // CK19-USE-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] + // CK19-USE-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]] + // CK19-USE-DAG: [[CSVAL1]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} + // CK19-USE-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}} + + // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-NOUSE-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK19-NOUSE-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK19-NOUSE-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]] + // CK19-NOUSE-DAG: [[CSVAL0]] = {{mul nuw i64 %.*, 4|sext i32 .+ to i64}} + // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[VAR0]], i{{.+}} %{{.+}} + + // CK19-USE: call void [[CALL21:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL21:@.+]]() + #pragma omp target map(tofrom:va[ii:ii+23]) + { +#ifdef USE + va[50]++; +#endif + } + + // Region 22 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|2}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[SIZE22]], {{.+}}getelementptr {{.+}}[{{1|2}} x i{{.+}}]* [[MTYPE22]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* + // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]] + // CK19-USE-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]] + + // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** + // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK19-USE-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] + // CK19-USE-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] + // CK19-USE-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}} + + // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-NOUSE-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK19-NOUSE-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[VAR0]], i{{.+}} %{{.+}} + + // CK19-USE: call void [[CALL22:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL22:@.+]]() + #pragma omp target map(tofrom:va[ii]) + { +#ifdef USE + va[15]++; +#endif + } + + // Always. + // Region 23 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE23]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE23]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]] + + // CK19-USE: call void [[CALL23:@.+]](i32* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL23:@.+]]() + #pragma omp target map(always, tofrom: a) + { +#ifdef USE + a++; +#endif + } + + // Multidimensional arrays. + int marr[4][5][6]; + int ***mptr; + + // Region 24 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE24]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE24]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [4 x [5 x [6 x i32]]]** + // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]] + // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0]], [4 x [5 x [6 x i32]]]** [[CP0]] + + // CK19-USE: call void [[CALL24:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL24:@.+]]() + #pragma omp target map(tofrom: marr) + { +#ifdef USE + marr[1][2][3]++; +#endif + } + + // Region 25 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE25]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE25]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 2 + // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2 + // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1 + + // CK19-USE: call void [[CALL25:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL25:@.+]]() + #pragma omp target map(tofrom: marr[1][2][2:4]) + { +#ifdef USE + marr[1][2][3]++; +#endif + } + + // Region 26 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE26]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE26]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2 + // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1 + + // CK19-USE: call void [[CALL26:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL26:@.+]]() + #pragma omp target map(tofrom: marr[1][2][:]) + { +#ifdef USE + marr[1][2][3]++; +#endif + } + + // Region 27 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE27]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE27]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 3 + // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2 + // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1 + + // CK19-USE: call void [[CALL27:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL27:@.+]]() + #pragma omp target map(tofrom: marr[1][2][3]) + { +#ifdef USE + marr[1][2][3]++; +#endif + } + + // Region 28 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE28]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE28]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**** + // CK19-DAG: store i32*** [[VAR0:%.+]], i32**** [[CBP0]] + // CK19-DAG: store i32*** [[SEC0:%.+]], i32**** [[CP0]] + // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]], + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1 + // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]], + + // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**** + // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32*** + // CK19-DAG: store i32*** [[SEC0]], i32**** [[CBP1]] + // CK19-DAG: store i32** [[SEC1:%.+]], i32*** [[CP1]] + // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2 + // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]], + // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1 + // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]], + + // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i32*** + // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** + // CK19-DAG: store i32** [[SEC1]], i32*** [[CBP2]] + // CK19-DAG: store i32* [[SEC2:%.+]], i32** [[CP2]] + // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 2 + // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]], + // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2 + // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]], + // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1 + // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]], + + // CK19-USE: call void [[CALL28:@.+]](i32*** {{[^,]+}}) + // CK19-NOUSE: call void [[CALL28:@.+]]() + #pragma omp target map(tofrom: mptr[1][2][2:4]) + { +#ifdef USE + mptr[1][2][3]++; +#endif + } + + // Region 29 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE29]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE29]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**** + // CK19-DAG: store i32*** [[VAR0:%.+]], i32**** [[CBP0]] + // CK19-DAG: store i32*** [[SEC0:%.+]], i32**** [[CP0]] + // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]], + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1 + // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]], + + // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**** + // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32*** + // CK19-DAG: store i32*** [[SEC0]], i32**** [[CBP1]] + // CK19-DAG: store i32** [[SEC1:%.+]], i32*** [[CP1]] + // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2 + // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]], + // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1 + // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]], + + // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i32*** + // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** + // CK19-DAG: store i32** [[SEC1]], i32*** [[CBP2]] + // CK19-DAG: store i32* [[SEC2:%.+]], i32** [[CP2]] + // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 3 + // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]], + // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2 + // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]], + // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1 + // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]], + + // CK19-USE: call void [[CALL29:@.+]](i32*** {{[^,]+}}) + // CK19-NOUSE: call void [[CALL29:@.+]]() + #pragma omp target map(tofrom: mptr[1][2][3]) + { +#ifdef USE + mptr[1][2][3]++; +#endif + } + + // Multidimensional VLA. + double mva[23][ii][ii+5]; + + // Region 30 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|4}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|4}} x i{{.+}}]* [[MTYPE30]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + // + // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* + // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] 23, i[[Z]]* [[CBP0]] + // CK19-USE-DAG: store i[[Z]] 23, i[[Z]]* [[CP0]] + // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S0]] + // + // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]* + // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]] + // CK19-USE-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]] + // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S1]] + // CK19-64-USE-DAG: [[VAR1]] = zext i32 %{{[^,]+}} to i64 + // CK19-64-USE-DAG: [[VAR11]] = zext i32 %{{[^,]+}} to i64 + // + // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i[[Z]]* + // CK19-USE-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] [[VAR2:%.+]], i[[Z]]* [[CBP2]] + // CK19-USE-DAG: store i[[Z]] [[VAR22:%.+]], i[[Z]]* [[CP2]] + // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S2]] + // CK19-64-USE-DAG: [[VAR2]] = zext i32 %{{[^,]+}} to i64 + // CK19-64-USE-DAG: [[VAR22]] = zext i32 %{{[^,]+}} to i64 + // + // CK19-USE-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3 + // CK19-USE-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3 + // CK19-USE-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3 + // CK19-USE-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double** + // CK19-USE-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double** + // CK19-USE-DAG: store double* [[VAR3:%.+]], double** [[CBP3]] + // CK19-USE-DAG: store double* [[VAR3]], double** [[CP3]] + // CK19-USE-DAG: store i64 [[CSVAL3:%[^,]+]], i64* [[S3]] + // CK19-USE-DAG: [[CSVAL3]] = {{mul nuw i64 %[^,]+, 8|sext i32 .+ to i64}} + + // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to double** + // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to double** + // CK19-NOUSE-DAG: store double* [[VAR0:%.+]], double** [[CBP0]] + // CK19-NOUSE-DAG: store double* [[VAR0]], double** [[CP0]] + // CK19-NOUSE-DAG: store i64 [[CSVAL0:%[^,]+]], i64* [[S0]] + // CK19-NOUSE-DAG: [[CSVAL0]] = {{mul nuw i64 %[^,]+, 8|sext i32 .+ to i64}} + + // CK19-USE: call void [[CALL30:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}}) + // CK19-NOUSE: call void [[CALL30:@.+]]() + #pragma omp target map(tofrom: mva) + { +#ifdef USE + mva[1][2][3]++; +#endif + } + + // Region 31 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|4}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[{{1|4}} x i{{.+}}]* [[SIZE31]], {{.+}}getelementptr {{.+}}[{{1|4}} x i{{.+}}]* [[MTYPE31]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // + // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* + // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] 23, i[[Z]]* [[CBP0]] + // CK19-USE-DAG: store i[[Z]] 23, i[[Z]]* [[CP0]] + // + // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]* + // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]] + // CK19-USE-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]] + // + // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i[[Z]]* + // CK19-USE-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] [[VAR2:%.+]], i[[Z]]* [[CBP2]] + // CK19-USE-DAG: store i[[Z]] [[VAR22:%.+]], i[[Z]]* [[CP2]] + // + // CK19-USE-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3 + // CK19-USE-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3 + // CK19-USE-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double** + // CK19-USE-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double** + // CK19-USE-DAG: store double* [[VAR3:%.+]], double** [[CBP3]] + // CK19-USE-DAG: store double* [[SEC3:%.+]], double** [[CP3]] + // CK19-USE-DAG: [[SEC3]] = getelementptr {{.*}}double* [[SEC33:%.+]], i[[Z]] 0 + // CK19-USE-DAG: [[SEC33]] = getelementptr {{.*}}double* [[SEC333:%.+]], i[[Z]] [[IDX3:%.+]] + // CK19-USE-DAG: [[IDX3]] = mul nsw i[[Z]] %{{[^,]+}}, %{{[^,]+}} + // CK19-USE-DAG: [[SEC333]] = getelementptr {{.*}}double* [[VAR3]], i[[Z]] [[IDX33:%.+]] + // CK19-USE-DAG: [[IDX33]] = mul nsw i[[Z]] 1, %{{[^,]+}} + + // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to double** + // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to double** + // CK19-NOUSE-DAG: store double* [[VAR0:%.+]], double** [[CBP0]] + // CK19-NOUSE-DAG: store double* [[SEC0:%.+]], double** [[CP0]] + // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.*}}double* [[SEC00:%.+]], i[[Z:64|32]] 0 + // CK19-NOUSE-DAG: [[SEC00]] = getelementptr {{.*}}double* [[SEC000:%.+]], i[[Z]] [[IDX0:%.+]] + // CK19-NOUSE-DAG: [[IDX0]] = mul nsw i[[Z]] %{{[^,]+}}, %{{[^,]+}} + // CK19-NOUSE-DAG: [[SEC000]] = getelementptr {{.*}}double* [[VAR0]], i[[Z]] [[IDX00:%.+]] + // CK19-NOUSE-DAG: [[IDX00]] = mul nsw i[[Z]] 1, %{{[^,]+}} + + // CK19-USE: call void [[CALL31:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}}) + // CK19-NOUSE: call void [[CALL31:@.+]]() + #pragma omp target map(tofrom: mva[1][ii-2][:5]) + { +#ifdef USE + mva[1][2][3]++; +#endif + } + + // Multidimensional array sections. + double marras[11][12][13]; + double mvlaas[11][ii][13]; + double ***mptras; + + // Region 32 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE32]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE32]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [11 x [12 x [13 x double]]]** + // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]] + // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0]], [11 x [12 x [13 x double]]]** [[CP0]] + + // CK19-USE: call void [[CALL32:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL32:@.+]]() + #pragma omp target map(marras) + { +#ifdef USE + marras[1][2][3]++; +#endif + } + + // Region 33 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE33]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE33]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [12 x [13 x double]]** + // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]] + // CK19-DAG: store [12 x [13 x double]]* [[SEC0:%.+]], [12 x [13 x double]]** [[CP0]] + // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0 + + // CK19-USE: call void [[CALL33:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL33:@.+]]() + #pragma omp target map(marras[:]) + { +#ifdef USE + marras[1][2][3]++; +#endif + } + + // Region 34 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE34]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE34]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [12 x [13 x double]]** + // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]] + // CK19-DAG: store [12 x [13 x double]]* [[SEC0:%.+]], [12 x [13 x double]]** [[CP0]] + // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0 + + // CK19-USE: call void [[CALL34:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL34:@.+]]() + #pragma omp target map(marras[:][:][:]) + { +#ifdef USE + marras[1][2][3]++; +#endif + } + + // Region 35 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE35]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + // + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** + // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]] + // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]] + // CK19-DAG: store i64 [[CSVAL0:%[^,]+]], i64* [[S0]] + // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0 + // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1 + // CK19-DAG: [[CSVAL0]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} + + // CK19-USE: call void [[CALL35:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL35:@.+]]() + #pragma omp target map(marras[1][:ii][:]) + { +#ifdef USE + marras[1][2][3]++; +#endif + } + + // Region 36 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE36]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE36]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** + // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]] + // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]] + // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[SEC00:%[^,]+]], i{{.+}} 0 + // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[SEC000]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0 + + // CK19-USE: call void [[CALL36:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL36:@.+]]() + #pragma omp target map(marras[:1][:2][:13]) + { +#ifdef USE + marras[1][2][3]++; +#endif + } + + // Region 37 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|3}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|3}} x i{{.+}}]* [[MTYPE37]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + // + // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* + // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]] + // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]] + // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S0]] + // + // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]* + // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]] + // CK19-USE-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]] + // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S1]] + // + // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]** + // CK19-USE-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]** + // CK19-USE-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]] + // CK19-USE-DAG: store [13 x double]* [[VAR2]], [13 x double]** [[CP2]] + // CK19-USE-DAG: store i64 [[CSVAL2:%[^,]+]], i64* [[S2]] + // CK19-USE-DAG: [[CSVAL2]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} + + // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [13 x double]** + // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** + // CK19-NOUSE-DAG: store [13 x double]* [[VAR0:%.+]], [13 x double]** [[CBP0]] + // CK19-NOUSE-DAG: store [13 x double]* [[VAR0]], [13 x double]** [[CP0]] + // CK19-NOUSE-DAG: store i64 [[CSVAL0:%[^,]+]], i64* [[S0]] + // CK19-NOUSE-DAG: [[CSVAL0]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} + + // CK19-USE: call void [[CALL37:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}}) + // CK19-NOUSE: call void [[CALL37:@.+]]() + #pragma omp target map(mvlaas) + { +#ifdef USE + mvlaas[1][2][3]++; +#endif + } + + // Region 38 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|3}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|3}} x i{{.+}}]* [[MTYPE38]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + // + // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* + // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]] + // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]] + // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S0]] + // + // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]* + // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]] + // CK19-USE-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]] + // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S1]] + // + // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]** + // CK19-USE-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]** + // CK19-USE-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]] + // CK19-USE-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]] + // CK19-USE-DAG: store i64 [[CSVAL2:%[^,]+]], i64* [[S2]] + // CK19-USE-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]] + // CK19-USE-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}} + // CK19-USE-DAG: [[CSVAL2]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} + + // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [13 x double]** + // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** + // CK19-NOUSE-DAG: store [13 x double]* [[VAR0:%.+]], [13 x double]** [[CBP0]] + // CK19-NOUSE-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]] + // CK19-NOUSE-DAG: store i64 [[CSVAL0:%[^,]+]], i64* [[S0]] + // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[VAR0]], i[[Z]] [[SEC00:%[^,]+]] + // CK19-NOUSE-DAG: [[SEC00]] = mul nsw i[[Z]] 0, %{{[^,]+}} + // CK19-NOUSE-DAG: [[CSVAL0]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} + + // CK19-USE: call void [[CALL38:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}}) + // CK19-NOUSE: call void [[CALL38:@.+]]() + #pragma omp target map(mvlaas[:]) + { +#ifdef USE + mvlaas[1][2][3]++; +#endif + } + + // Region 39 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|3}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|3}} x i{{.+}}]* [[MTYPE39]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + // + // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* + // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]] + // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]] + // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S0]] + // + // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]* + // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]] + // CK19-USE-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]] + // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S1]] + // + // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]** + // CK19-USE-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]** + // CK19-USE-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]] + // CK19-USE-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]] + // CK19-USE-DAG: store i64 [[CSVAL2:%[^,]+]], i64* [[S2]] + // CK19-USE-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]] + // CK19-USE-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}} + // CK19-USE-DAG: [[CSVAL2]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} + + // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [13 x double]** + // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** + // CK19-NOUSE-DAG: store [13 x double]* [[VAR0:%.+]], [13 x double]** [[CBP0]] + // CK19-NOUSE-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]] + // CK19-NOUSE-DAG: store i64 [[CSVAL0:%[^,]+]], i64* [[S0]] + // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[VAR0]], i[[Z]] [[SEC00:%[^,]+]] + // CK19-NOUSE-DAG: [[SEC00]] = mul nsw i[[Z]] 0, %{{[^,]+}} + // CK19-NOUSE-DAG: [[CSVAL0]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} + + // CK19-USE: call void [[CALL39:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}}) + // CK19-NOUSE: call void [[CALL39:@.+]]() + #pragma omp target map(mvlaas[:][:][:]) + { +#ifdef USE + mvlaas[1][2][3]++; +#endif + } + + // Region 40 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|3}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[{{1|3}} x i{{.+}}]* [[MTYPE40]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + // + // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* + // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]] + // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]] + // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S0]] + // + // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]* + // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]] + // CK19-USE-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]] + // CK19-USE-DAG: store i64 {{8|4}}, i64* [[S1]] + // + // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]** + // CK19-USE-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]** + // CK19-USE-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]] + // CK19-USE-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]] + // CK19-USE-DAG: store i64 [[CSVAL2:%[^,]+]], i64* [[S2]] + // CK19-USE-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0 + // CK19-USE-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]] + // CK19-USE-DAG: [[SEC222]] = mul nsw i[[Z]] 1, %{{[^,]+}} + + // CK19-NOUSE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK19-NOUSE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [13 x double]** + // CK19-NOUSE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** + // CK19-NOUSE-DAG: store [13 x double]* [[VAR0:%.+]], [13 x double]** [[CBP0]] + // CK19-NOUSE-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]] + // CK19-NOUSE-DAG: store i64 [[CSVAL0:%[^,]+]], i64* [[S0]] + // CK19-NOUSE-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[SEC00:%[^,]+]], i[[Z]] 0 + // CK19-NOUSE-DAG: [[SEC00]] = getelementptr {{.+}}[13 x double]* [[VAR0]], i[[Z]] [[SEC000:%[^,]+]] + // CK19-NOUSE-DAG: [[SEC000]] = mul nsw i[[Z]] 1, %{{[^,]+}} + + // CK19-USE: call void [[CALL40:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}}) + // CK19-NOUSE: call void [[CALL40:@.+]]() + #pragma omp target map(mvlaas[1][:ii][:]) + { +#ifdef USE + mvlaas[1][2][3]++; +#endif + } + + // Region 41 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 {{1|3}}, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[{{1|3}} x i{{.+}}]* [[SIZE41]], {{.+}}getelementptr {{.+}}[{{1|3}} x i{{.+}}]* [[MTYPE41]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // + // CK19-USE-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]* + // CK19-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]] + // CK19-USE-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]] + // + // CK19-USE-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-USE-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]* + // CK19-USE-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* + // CK19-USE-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]] + // CK19-USE-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]] + // + // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK19-USE-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]** + // CK19-USE-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]** + // CK19-USE-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]] + // CK19-USE-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]] + // CK19-USE-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0 + // CK19-USE-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]] + // CK19-USE-DAG: [[SEC222]] = mul nsw i[[Z]] 0, %{{[^,]+}} + // CK19-USE-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + + // CK19-NO-USE-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-NO-USE-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [13 x double]** + // CK19-NO-USE-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** + // CK19-NO-USE-DAG: store [13 x double]* [[VAR0:%.+]], [13 x double]** [[CBP0]] + // CK19-NO-USE-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]] + // CK19-NO-USE-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[SEC00:%[^,]+]], i[[Z]] 0 + // CK19-NO-USE-DAG: [[SEC00]] = getelementptr {{.+}}[13 x double]* [[VAR0]], i[[Z]] [[SEC000:%[^,]+]] + // CK19-NO-USE-DAG: [[SEC000]] = mul nsw i[[Z]] 0, %{{[^,]+}} + + // CK19-USE: call void [[CALL41:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}}) + // CK19-NOUSE: call void [[CALL41:@.+]]() + #pragma omp target map(mvlaas[:1][:2][:13]) + { +#ifdef USE + mvlaas[1][2][3]++; +#endif + } + + // Region 42 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE42]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE42]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to double**** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to double**** + // CK19-DAG: store double*** [[VAR0:%.+]], double**** [[CBP0]] + // CK19-DAG: store double*** [[SEC0:%.+]], double**** [[CP0]] + // CK19-DAG: [[VAR0]] = load double***, double**** [[PTR:%[^,]+]], + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}double*** [[SEC00:[^,]+]], i{{.+}} 0 + // CK19-DAG: [[SEC00]] = load double***, double**** [[PTR]], + + // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double**** + // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double*** + // CK19-DAG: store double*** [[SEC0]], double**** [[CBP1]] + // CK19-DAG: store double** [[SEC1:%.+]], double*** [[CP1]] + // CK19-DAG: [[SEC1]] = getelementptr {{.*}}double** [[SEC11:[^,]+]], i{{.+}} 2 + // CK19-DAG: [[SEC11]] = load double**, double*** [[SEC111:%[^,]+]], + // CK19-DAG: [[SEC111]] = getelementptr {{.*}}double*** [[SEC1111:[^,]+]], i{{.+}} 0 + // CK19-DAG: [[SEC1111]] = load double***, double**** [[PTR]], + + // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double*** + // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** + // CK19-DAG: store double** [[SEC1]], double*** [[CBP2]] + // CK19-DAG: store double* [[SEC2:%.+]], double** [[CP2]] + // CK19-DAG: [[SEC2]] = getelementptr {{.*}}double* [[SEC22:[^,]+]], i{{.+}} 0 + // CK19-DAG: [[SEC22]] = load double*, double** [[SEC222:%[^,]+]], + // CK19-DAG: [[SEC222]] = getelementptr {{.*}}double** [[SEC2222:[^,]+]], i{{.+}} 2 + // CK19-DAG: [[SEC2222]] = load double**, double*** [[SEC22222:%[^,]+]], + // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}double*** [[SEC222222:[^,]+]], i{{.+}} 0 + // CK19-DAG: [[SEC222222]] = load double***, double**** [[PTR]], + + // CK19-USE: call void [[CALL42:@.+]](double*** {{[^,]+}}) + // CK19-NOUSE: call void [[CALL42:@.+]]() + #pragma omp target map(mptras[:1][2][:13]) + { +#ifdef USE + mptras[1][2][3]++; +#endif + } + + // Region 43 - the memory is not contiguous for this map - will map the whole last dimension. + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE43]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + // + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]** + // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]] + // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]] + // CK19-DAG: store i64 [[CSVAL0:%[^,]+]], i64* [[S0]] + // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0 + // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1 + // CK19-DAG: [[CSVAL0]] = {{mul nuw i64 %[^,]+, 104|sext i32 .+ to i64}} + + // CK19-USE: call void [[CALL43:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL43:@.+]]() + #pragma omp target map(marras[1][:ii][1:]) + { +#ifdef USE + marras[1][2][3]++; +#endif + } + + // Region 44 + // CK19-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE44]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE44]]{{.+}}, i8** null) + // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** + // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]] + // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]] + // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 20 + + // CK19-USE: call void [[CALL44:@.+]]([100 x i32]* {{[^,]+}}) + // CK19-NOUSE: call void [[CALL44:@.+]]() + #pragma omp target map(from:arra[20:]) + { +#ifdef USE + arra[50]++; +#endif + } + +} + +// CK19: define {{.+}}[[CALL00]] +// CK19: define {{.+}}[[CALL01]] +// CK19: define {{.+}}[[CALL02]] +// CK19: define {{.+}}[[CALL03]] +// CK19: define {{.+}}[[CALL04]] +// CK19: define {{.+}}[[CALL05]] +// CK19: define {{.+}}[[CALL06]] +// CK19: define {{.+}}[[CALL07]] +// CK19: define {{.+}}[[CALL08]] +// CK19: define {{.+}}[[CALL09]] +// CK19: define {{.+}}[[CALL10]] +// CK19: define {{.+}}[[CALL11]] +// CK19: define {{.+}}[[CALL12]] +// CK19: define {{.+}}[[CALL13]] +// CK19: define {{.+}}[[CALL14]] +// CK19: define {{.+}}[[CALL15]] +// CK19: define {{.+}}[[CALL16]] +// CK19: define {{.+}}[[CALL17]] +// CK19: define {{.+}}[[CALL18]] +// CK19: define {{.+}}[[CALL19]] +// CK19: define {{.+}}[[CALL20]] +// CK19: define {{.+}}[[CALL21]] +// CK19: define {{.+}}[[CALL22]] +// CK19: define {{.+}}[[CALL23]] +// CK19: define {{.+}}[[CALL24]] +// CK19: define {{.+}}[[CALL25]] +// CK19: define {{.+}}[[CALL26]] +// CK19: define {{.+}}[[CALL27]] +// CK19: define {{.+}}[[CALL28]] +// CK19: define {{.+}}[[CALL29]] +// CK19: define {{.+}}[[CALL30]] +// CK19: define {{.+}}[[CALL31]] +// CK19: define {{.+}}[[CALL32]] +// CK19: define {{.+}}[[CALL33]] +// CK19: define {{.+}}[[CALL34]] +// CK19: define {{.+}}[[CALL35]] +// CK19: define {{.+}}[[CALL36]] +// CK19: define {{.+}}[[CALL37]] +// CK19: define {{.+}}[[CALL38]] +// CK19: define {{.+}}[[CALL39]] +// CK19: define {{.+}}[[CALL40]] +// CK19: define {{.+}}[[CALL41]] +// CK19: define {{.+}}[[CALL42]] +// CK19: define {{.+}}[[CALL43]] +// CK19: define {{.+}}[[CALL44]] + +#endif // CK19 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_19.cpp b/clang/test/OpenMP/target_map_codegen_19.cpp new file mode 100644 index 00000000000000..8b4259a2e0053b --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_19.cpp @@ -0,0 +1,147 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64 +// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64 +// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32 +// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32 + +// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64 +// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64 +// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32 +// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32 + +// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64 +// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64 +// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32 +// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32 + +// RUN: %clang_cc1 -DCK20 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s +// RUN: %clang_cc1 -DCK20 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s +// RUN: %clang_cc1 -DCK20 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s +// RUN: %clang_cc1 -DCK20 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s +// SIMD-ONLY19-NOT: {{__kmpc|__tgt}} +#ifdef CK20 + +// CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK20: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK20: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 33] + +// CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK20: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 20] +// CK20: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 33] + +// CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK20: [[SIZE02:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK20: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 34] + +// CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK20: [[SIZE03:@.+]] = private {{.*}}constant [1 x i64] [i64 12] +// CK20: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 34] + +// CK20-LABEL: explicit_maps_references_and_function_args{{.*}}( +void explicit_maps_references_and_function_args (int a, float b, int (&c)[10], float *d){ + + int &aa = a; + float &bb = b; + int (&cc)[10] = c; + float *&dd = d; + + // Region 00 + // CK20-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) + // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK20-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] + // CK20-DAG: store i32* [[RVAR00:%.+]], i32** [[CP0]] + // CK20-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] + // CK20-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] + + // CK20: call void [[CALL00:@.+]](i32* {{[^,]+}}) + #pragma omp target map(to:aa) + { + aa += 1; + } + + // Region 01 + // CK20-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) + // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [10 x i32]** + // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK20-DAG: store [10 x i32]* [[RVAR0:%.+]], [10 x i32]** [[CBP0]] + // CK20-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK20-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[RVAR00:%.+]], i{{.+}} 0, i{{.+}} 0 + // CK20-DAG: [[RVAR0]] = load [10 x i32]*, [10 x i32]** [[VAR0:%[^,]+]] + // CK20-DAG: [[RVAR00]] = load [10 x i32]*, [10 x i32]** [[VAR0]] + + // CK20: call void [[CALL01:@.+]]([10 x i32]* {{[^,]+}}) + #pragma omp target map(to:cc[:5]) + { + cc[3] += 1; + } + + // Region 02 + // CK20-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) + // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float** + // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float** + // CK20-DAG: store float* [[VAR0:%.+]], float** [[CBP0]] + // CK20-DAG: store float* [[VAR0]], float** [[CP0]] + + // CK20: call void [[CALL02:@.+]](float* {{[^,]+}}) + #pragma omp target map(from:b) + { + b += 1.0f; + } + + // Region 03 + // CK20-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}}, i8** null) + // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float** + // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float** + // CK20-DAG: store float* [[RVAR0:%.+]], float** [[CBP0]] + // CK20-DAG: store float* [[SEC0:%.+]], float** [[CP0]] + // CK20-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]] + // CK20-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2 + // CK20-DAG: [[RVAR00]] = load float*, float** [[VAR0]] + + // CK20: call void [[CALL03:@.+]](float* {{[^,]+}}) + #pragma omp target map(from:d[2:3]) + { + d[2] += 1.0f; + } +} + +// CK20: define {{.+}}[[CALL00]] +// CK20: define {{.+}}[[CALL01]] +// CK20: define {{.+}}[[CALL02]] +// CK20: define {{.+}}[[CALL03]] + +#endif // CK20 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_20.cpp b/clang/test/OpenMP/target_map_codegen_20.cpp new file mode 100644 index 00000000000000..1913c2e2484d1a --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_20.cpp @@ -0,0 +1,298 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-USE +// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-USE +// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-USE +// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-USE + +// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-USE +// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-USE +// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-USE +// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-USE + +// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-USE +// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-USE +// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-USE +// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-USE + +// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s +// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s +// RUN: %clang_cc1 -DUSE -DCK21 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s +// RUN: %clang_cc1 -DUSE -DCK21 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s + +// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-NOUSE +// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-NOUSE +// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-NOUSE +// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-NOUSE + +// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-NOUSE +// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-NOUSE +// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-NOUSE +// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-NOUSE + +// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-NOUSE +// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-64,CK21-NOUSE +// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-NOUSE +// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK21,CK21-32,CK21-NOUSE + +// RUN: %clang_cc1 -DCK21 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s +// RUN: %clang_cc1 -DCK21 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s +// RUN: %clang_cc1 -DCK21 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s +// RUN: %clang_cc1 -DCK21 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s + +// SIMD-ONLY20-NOT: {{__kmpc|__tgt}} +#ifdef CK21 +// CK21: [[ST:%.+]] = type { i32, i32, float* } + +// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK21: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] + +// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK21: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 492] +// CK21: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK21: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710674] + +// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK21: [[SIZE03:@.+]] = private {{.*}}constant [1 x i64] [i64 492] +// CK21: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 34] + +// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK21: [[SIZE04:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK21: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 34] + +// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK21: [[MTYPE05:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710659, i64 281474976710659] + +// CK21-LABEL: explicit_maps_template_args_and_members{{.*}}( + +template +struct CC { + T A; + int A2; + float *B; + + int foo(T arg) { + float la[X]; + T *lb; + + // Region 00 + // CK21-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) + // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK21-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK21-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** + // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] + // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK21-DAG: store i64 {{%.+}}, i64* [[S0]] + // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0 + + // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK21-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** + // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK21-DAG: store [[ST]]* [[VAR1:%.+]], [[ST]]** [[CBP1]] + // CK21-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] + // CK21-DAG: store i64 {{.+}}, i64* [[S1]] + // CK21-DAG: [[SEC1]] = getelementptr {{.*}}[[ST]]* [[VAR1:%.+]], i{{.+}} 0, i{{.+}} 0 + + // CK21-USE: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}}) + // CK21-NOUSE: call void [[CALL00:@.+]]() + #pragma omp target map(A) + { +#ifdef USE + A += 1; +#endif + } + + // Region 01 + // CK21-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) + // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK21-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] + // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK21-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] + // CK21-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0 + // CK21-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] + + // CK21-USE: call void [[CALL01:@.+]](i32* {{[^,]+}}) + // CK21-NOUSE: call void [[CALL01:@.+]]() + #pragma omp target map(lb[:X]) + { +#ifdef USE + lb[4] += 1; +#endif + } + + // Region 02 + // CK21-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) + // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK21-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK21-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** + // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float*** + // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] + // CK21-DAG: store float** [[SEC0:%.+]], float*** [[CP0]] + // CK21-DAG: store i64 {{%.+}}, i64* [[S0]] + // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2 + + // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK21-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float*** + // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float** + // CK21-DAG: store float** [[SEC0]], float*** [[CBP1]] + // CK21-DAG: store float* [[SEC1:%.+]], float** [[CP1]] + // CK21-DAG: store i64 {{.+}}, i64* [[S1]] + // CK21-DAG: [[SEC1]] = getelementptr {{.*}}float* [[RVAR1:%[^,]+]], i{{.+}} 123 + // CK21-DAG: [[RVAR1]] = load float*, float** [[SEC1_:%[^,]+]] + // CK21-DAG: [[SEC1_]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2 + + // CK21-USE: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}}) + // CK21-NOUSE: call void [[CALL02:@.+]]() + #pragma omp target map(from:B[X:X+2]) + { +#ifdef USE + B[2] += 1.0f; +#endif + } + + // Region 03 + // CK21-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}}, i8** null) + // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [123 x float]** + // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [123 x float]** + // CK21-DAG: store [123 x float]* [[VAR0:%.+]], [123 x float]** [[CBP0]] + // CK21-DAG: store [123 x float]* [[VAR0]], [123 x float]** [[CP0]] + + // CK21-USE: call void [[CALL03:@.+]]([123 x float]* {{[^,]+}}) + // CK21-NOUSE: call void [[CALL03:@.+]]() + #pragma omp target map(from:la) + { +#ifdef USE + la[3] += 1.0f; +#endif + } + + // Region 04 + // CK21-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}}, i8** null) + // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK21-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK21-DAG: store i32* [[VAR0]], i32** [[CP0]] + + // CK21-USE: call void [[CALL04:@.+]](i32* {{[^,]+}}) + // CK21-NOUSE: call void [[CALL04:@.+]]() + #pragma omp target map(from:arg) + { +#ifdef USE + arg +=1; +#endif + } + + // Make sure the extra flag is passed to the second map. + // Region 05 + // CK21-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE05]]{{.+}}, i8** null) + // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK21-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK21-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** + // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] + // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK21-DAG: store i64 {{%.+}}, i64* [[S0]] + // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0 + + // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK21-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** + // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK21-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CBP1]] + // CK21-DAG: store i32* [[SEC0]], i32** [[CP1]] + // CK21-DAG: store i64 {{.+}}, i64* [[S1]] + + // CK21-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK21-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK21-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 + // CK21-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]** + // CK21-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** + // CK21-DAG: store [[ST]]* [[VAR2:%.+]], [[ST]]** [[CBP2]] + // CK21-DAG: store i32* [[SEC2:%.+]], i32** [[CP2]] + // CK21-DAG: store i64 {{.+}}, i64* [[S2]] + // CK21-DAG: [[SEC2]] = getelementptr {{.*}}[[ST]]* [[VAR2]], i{{.+}} 0, i{{.+}} 1 + + // CK21-USE: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}}) + // CK21-NOUSE: call void [[CALL05:@.+]]() + #pragma omp target map(A, A2) + { +#ifdef USE + A += 1; + A2 += 1; +#endif + } + return A; + } +}; + +int explicit_maps_template_args_and_members(int a){ + CC<123,int> c; + return c.foo(a); +} + +// CK21: define {{.+}}[[CALL00]] +// CK21: define {{.+}}[[CALL01]] +// CK21: define {{.+}}[[CALL02]] +// CK21: define {{.+}}[[CALL03]] +// CK21: define {{.+}}[[CALL04]] +// CK21: define {{.+}}[[CALL05]] +#endif // CK21 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_21.cpp b/clang/test/OpenMP/target_map_codegen_21.cpp new file mode 100644 index 00000000000000..b78ab594fd6d7b --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_21.cpp @@ -0,0 +1,386 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-64 +// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-64 +// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-32 +// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-32 + +// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-64 +// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-64 +// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-32 +// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-32 + +// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-64 +// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-64 +// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-32 +// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-32 + +// RUN: %clang_cc1 -DCK22 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY21 %s +// RUN: %clang_cc1 -DCK22 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY21 %s +// RUN: %clang_cc1 -DCK22 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY21 %s +// RUN: %clang_cc1 -DCK22 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY21 %s +// SIMD-ONLY21-NOT: {{__kmpc|__tgt}} +#ifdef CK22 + +// CK22-DAG: [[ST:%.+]] = type { float } +// CK22-DAG: [[STT:%.+]] = type { i32 } + +// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK22: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK22: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK22: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 400] +// CK22: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK22: [[SIZE02:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] +// CK22: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK22: [[SIZE03:@.+]] = private {{.*}}constant [1 x i64] [i64 16] +// CK22: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK22: [[SIZE04:@.+]] = private {{.*}}constant [1 x i64] [i64 20] +// CK22: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 51] + +// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK22: [[SIZE05:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK22: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK22: [[SIZE06:@.+]] = private {{.*}}constant [1 x i64] [i64 400] +// CK22: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK22: [[SIZE07:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] +// CK22: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK22: [[SIZE08:@.+]] = private {{.*}}constant [1 x i64] [i64 16] +// CK22: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK22: [[SIZE09:@.+]] = private {{.*}}constant [1 x i64] [i64 20] +// CK22: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 51] + +// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK22: [[SIZE10:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK22: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK22: [[SIZE11:@.+]] = private {{.*}}constant [1 x i64] [i64 400] +// CK22: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK22: [[SIZE12:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] +// CK22: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK22: [[SIZE13:@.+]] = private {{.*}}constant [1 x i64] [i64 16] +// CK22: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK22: [[SIZE14:@.+]] = private {{.*}}constant [1 x i64] [i64 20] +// CK22: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i64] [i64 51] + +int a; +int c[100]; +int *d; + +struct ST { + float fa; +}; + +ST sa ; +ST sc[100]; +ST *sd; + +template +struct STT { + T fa; +}; + +STT sta ; +STT stc[100]; +STT *std; + +// CK22-LABEL: explicit_maps_globals{{.*}}( +int explicit_maps_globals(void){ + // Region 00 + // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) + // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK22-DAG: store i32* @a, i32** [[CBP0]] + // CK22-DAG: store i32* @a, i32** [[CP0]] + + // CK22: call void [[CALL00:@.+]](i32* {{[^,]+}}) + #pragma omp target map(a) + { a+=1; } + + // Region 01 + // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) + // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** + // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x i32]** + // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CBP0]] + // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CP0]] + + // CK22: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}}) + #pragma omp target map(c) + { c[3]+=1; } + + // Region 02 + // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) + // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32*** + // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32*** + // CK22-DAG: store i32** @d, i32*** [[CBP0]] + // CK22-DAG: store i32** @d, i32*** [[CP0]] + + // CK22: call void [[CALL02:@.+]](i32** {{[^,]+}}) + #pragma omp target map(d) + { d[3]+=1; } + + // Region 03 + // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}}, i8** null) + // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]** + // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CBP0]] + // CK22-DAG: store i32* getelementptr inbounds ([100 x i32], [100 x i32]* @c, i{{.+}} 0, i{{.+}} 1), i32** [[CP0]] + + // CK22: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}}) + #pragma omp target map(c[1:4]) + { c[3]+=1; } + + // Region 04 + // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}}, i8** null) + // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32*** + // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK22-DAG: store i32** @d, i32*** [[CBP0]] + // CK22-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK22-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 2 + // CK22-DAG: [[RVAR00]] = load i32*, i32** @d + + // CK22: call void [[CALL04:@.+]](i32* {{[^,]+}}) + #pragma omp target map(d[2:5]) + { d[3]+=1; } + + // Region 05 + // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}}, i8** null) + // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** + // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]** + // CK22-DAG: store [[ST]]* @sa, [[ST]]** [[CBP0]] + // CK22-DAG: store [[ST]]* @sa, [[ST]]** [[CP0]] + + // CK22: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}}) + #pragma omp target map(sa) + { sa.fa+=1; } + + // Region 06 + // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE06]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}}, i8** null) + // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[ST]]]** + // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x [[ST]]]** + // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CBP0]] + // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CP0]] + + // CK22: call void [[CALL06:@.+]]([100 x [[ST]]]* {{[^,]+}}) + #pragma omp target map(sc) + { sc[3].fa+=1; } + + // Region 07 + // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE07]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}}, i8** null) + // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]*** + // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]*** + // CK22-DAG: store [[ST]]** @sd, [[ST]]*** [[CBP0]] + // CK22-DAG: store [[ST]]** @sd, [[ST]]*** [[CP0]] + + // CK22: call void [[CALL07:@.+]]([[ST]]** {{[^,]+}}) + #pragma omp target map(sd) + { sd[3].fa+=1; } + + // Region 08 + // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}}, i8** null) + // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[ST]]]** + // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]** + // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CBP0]] + // CK22-DAG: store [[ST]]* getelementptr inbounds ([100 x [[ST]]], [100 x [[ST]]]* @sc, i{{.+}} 0, i{{.+}} 1), [[ST]]** [[CP0]] + + // CK22: call void [[CALL08:@.+]]([100 x [[ST]]]* {{[^,]+}}) + #pragma omp target map(sc[1:4]) + { sc[3].fa+=1; } + + // Region 09 + // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}}, i8** null) + // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]*** + // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]** + // CK22-DAG: store [[ST]]** @sd, [[ST]]*** [[CBP0]] + // CK22-DAG: store [[ST]]* [[SEC0:%.+]], [[ST]]** [[CP0]] + // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[RVAR00:%.+]], i{{.+}} 2 + // CK22-DAG: [[RVAR00]] = load [[ST]]*, [[ST]]** @sd + + // CK22: call void [[CALL09:@.+]]([[ST]]* {{[^,]+}}) + #pragma omp target map(sd[2:5]) + { sd[3].fa+=1; } + + // Region 10 + // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}}, i8** null) + // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]** + // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]** + // CK22-DAG: store [[STT]]* @sta, [[STT]]** [[CBP0]] + // CK22-DAG: store [[STT]]* @sta, [[STT]]** [[CP0]] + + // CK22: call void [[CALL10:@.+]]([[STT]]* {{[^,]+}}) + #pragma omp target map(sta) + { sta.fa+=1; } + + // Region 11 + // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}}, i8** null) + // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[STT]]]** + // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x [[STT]]]** + // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CBP0]] + // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CP0]] + + // CK22: call void [[CALL11:@.+]]([100 x [[STT]]]* {{[^,]+}}) + #pragma omp target map(stc) + { stc[3].fa+=1; } + + // Region 12 + // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}}, i8** null) + // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]*** + // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]*** + // CK22-DAG: store [[STT]]** @std, [[STT]]*** [[CBP0]] + // CK22-DAG: store [[STT]]** @std, [[STT]]*** [[CP0]] + + // CK22: call void [[CALL12:@.+]]([[STT]]** {{[^,]+}}) + #pragma omp target map(std) + { std[3].fa+=1; } + + // Region 13 + // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE13]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}}, i8** null) + // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[STT]]]** + // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]** + // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CBP0]] + // CK22-DAG: store [[STT]]* getelementptr inbounds ([100 x [[STT]]], [100 x [[STT]]]* @stc, i{{.+}} 0, i{{.+}} 1), [[STT]]** [[CP0]] + + // CK22: call void [[CALL13:@.+]]([100 x [[STT]]]* {{[^,]+}}) + #pragma omp target map(stc[1:4]) + { stc[3].fa+=1; } + + // Region 14 + // CK22-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE14]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}}, i8** null) + // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]*** + // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]** + // CK22-DAG: store [[STT]]** @std, [[STT]]*** [[CBP0]] + // CK22-DAG: store [[STT]]* [[SEC0:%.+]], [[STT]]** [[CP0]] + // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[STT]]* [[RVAR00:%.+]], i{{.+}} 2 + // CK22-DAG: [[RVAR00]] = load [[STT]]*, [[STT]]** @std + + // CK22: call void [[CALL14:@.+]]([[STT]]* {{[^,]+}}) + #pragma omp target map(std[2:5]) + { std[3].fa+=1; } + + return 0; +} +// CK22: define {{.+}}[[CALL00]] +// CK22: define {{.+}}[[CALL01]] +// CK22: define {{.+}}[[CALL02]] +// CK22: define {{.+}}[[CALL03]] +// CK22: define {{.+}}[[CALL04]] +// CK22: define {{.+}}[[CALL05]] +// CK22: define {{.+}}[[CALL06]] +// CK22: define {{.+}}[[CALL07]] +// CK22: define {{.+}}[[CALL08]] +// CK22: define {{.+}}[[CALL09]] +// CK22: define {{.+}}[[CALL10]] +// CK22: define {{.+}}[[CALL11]] +// CK22: define {{.+}}[[CALL12]] +// CK22: define {{.+}}[[CALL13]] +// CK22: define {{.+}}[[CALL14]] +#endif // CK22 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_22.cpp b/clang/test/OpenMP/target_map_codegen_22.cpp new file mode 100644 index 00000000000000..0e86ed51629c01 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_22.cpp @@ -0,0 +1,200 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-64 +// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-64 +// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-32 +// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-32 + +// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-64 +// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-64 +// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-32 +// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-32 + +// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-64 +// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-64 +// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-32 +// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-32 + +// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY22 %s +// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++11 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY22 %s +// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY22 %s +// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++11 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY22 %s +// SIMD-ONLY22-NOT: {{__kmpc|__tgt}} +#ifdef CK23 + +// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK23: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK23: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK23: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK23: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK23: [[SIZE02:@.+]] = private {{.*}}constant [1 x i64] [i64 400] +// CK23: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK23: [[SIZE03:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] +// CK23: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK23: [[SIZE04:@.+]] = private {{.*}}constant [1 x i64] [i64 16] +// CK23: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK23: [[SIZE05:@.+]] = private {{.*}}constant [1 x i64] [i64 16] +// CK23: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK23-LABEL: explicit_maps_inside_captured{{.*}}( +int explicit_maps_inside_captured(int a){ + float b; + float c[100]; + float *d; + + // CK23: call void @{{.*}}explicit_maps_inside_captured{{.*}}([[SA:%.+]]* {{.*}}) + // CK23: define {{.*}}explicit_maps_inside_captured{{.*}} + [&](void){ + // Region 00 + // CK23-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) + // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK23-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK23-DAG: store i32* [[VAR00:%.+]], i32** [[CP0]] + // CK23-DAG: [[VAR0]] = load i32*, i32** [[CAP0:%[^,]+]] + // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]] + // CK23-DAG: [[VAR00]] = load i32*, i32** [[CAP00:%[^,]+]] + // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]] + + // CK23: call void [[CALL00:@.+]](i32* {{[^,]+}}) + #pragma omp target map(a) + { a+=1; } + // Region 01 + // CK23-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) + // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float** + // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float** + // CK23-DAG: store float* [[VAR0:%.+]], float** [[CBP0]] + // CK23-DAG: store float* [[VAR00:%.+]], float** [[CP0]] + // CK23-DAG: [[VAR0]] = load float*, float** [[CAP0:%[^,]+]] + // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]] + // CK23-DAG: [[VAR00]] = load float*, float** [[CAP00:%[^,]+]] + // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]] + + // CK23: call void [[CALL01:@.+]](float* {{[^,]+}}) + #pragma omp target map(b) + { b+=1; } + // Region 02 + // CK23-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) + // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x float]** + // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x float]** + // CK23-DAG: store [100 x float]* [[VAR0:%.+]], [100 x float]** [[CBP0]] + // CK23-DAG: store [100 x float]* [[VAR00:%.+]], [100 x float]** [[CP0]] + // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]] + // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]] + // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]] + // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]] + + // CK23: call void [[CALL02:@.+]]([100 x float]* {{[^,]+}}) + #pragma omp target map(c) + { c[3]+=1; } + + // Region 03 + // CK23-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}}, i8** null) + // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float*** + // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float*** + // CK23-DAG: store float** [[VAR0:%.+]], float*** [[CBP0]] + // CK23-DAG: store float** [[VAR00:%.+]], float*** [[CP0]] + // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]] + // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]] + // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]] + // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]] + + // CK23: call void [[CALL03:@.+]](float** {{[^,]+}}) + #pragma omp target map(d) + { d[3]+=1; } + // Region 04 + // CK23-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}}, i8** null) + // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x float]** + // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float** + // CK23-DAG: store [100 x float]* [[VAR0:%.+]], [100 x float]** [[CBP0]] + // CK23-DAG: store float* [[SEC0:%.+]], float** [[CP0]] + // CK23-DAG: [[SEC0]] = getelementptr {{.*}}[100 x float]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2 + // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]] + // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]] + // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]] + // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]] + + // CK23: call void [[CALL04:@.+]]([100 x float]* {{[^,]+}}) + #pragma omp target map(c[2:4]) + { c[3]+=1; } + + // Region 05 + // CK23-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}}, i8** null) + // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float** + // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float** + // CK23-DAG: store float* [[RVAR0:%.+]], float** [[CBP0]] + // CK23-DAG: store float* [[SEC0:%.+]], float** [[CP0]] + // CK23-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]] + // CK23-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2 + // CK23-DAG: [[RVAR00]] = load float*, float** [[VAR00:%[^,]+]] + // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]] + // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]] + // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]] + // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]] + + // CK23: call void [[CALL05:@.+]](float* {{[^,]+}}) + #pragma omp target map(d[2:4]) + { d[3]+=1; } + }(); + return b; +} + +// CK23: define {{.+}}[[CALL00]] +// CK23: define {{.+}}[[CALL01]] +// CK23: define {{.+}}[[CALL02]] +// CK23: define {{.+}}[[CALL03]] +// CK23: define {{.+}}[[CALL04]] +// CK23: define {{.+}}[[CALL05]] +#endif // CK23 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_23.cpp b/clang/test/OpenMP/target_map_codegen_23.cpp new file mode 100644 index 00000000000000..5bc469772266ad --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_23.cpp @@ -0,0 +1,634 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64 +// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64 +// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32 +// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32 + +// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64 +// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64 +// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32 +// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32 + +// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64 +// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64 +// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32 +// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32 + +// RUN: %clang_cc1 -DCK24 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY23 %s +// RUN: %clang_cc1 -DCK24 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY23 %s +// RUN: %clang_cc1 -DCK24 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY23 %s +// RUN: %clang_cc1 -DCK24 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY23 %s +// SIMD-ONLY23-NOT: {{__kmpc|__tgt}} +#ifdef CK24 + +// CK24-DAG: [[SC:%.+]] = type { i32, [[SB:%.+]], [[SB:%.+]]*, [10 x i32] } +// CK24-DAG: [[SB]] = type { i32, [[SA:%.+]], [10 x [[SA:%.+]]], [10 x [[SA:%.+]]*], [[SA:%.+]]* } +// CK24-DAG: [[SA]] = type { i32, [[SA]]*, [10 x i32] } + +struct SA{ + int a; + struct SA *p; + int b[10]; +}; +struct SB{ + int a; + struct SA s; + struct SA sa[10]; + struct SA *sp[10]; + struct SA *p; +}; +struct SC{ + int a; + struct SB s; + struct SB *p; + int b[10]; +}; + +// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK24: [[MTYPE01:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] + +// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK24: [[MTYPE13:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] + +// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK24: [[MTYPE14:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] + +// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK24: [[MTYPE15:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] + +// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK24: [[MTYPE16:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] + +// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK24: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710675] + +// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK24: [[MTYPE18:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] + +// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK24: [[MTYPE19:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710659, i64 281474976710675] + +// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK24: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710675] + +// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK24: [[MTYPE21:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710659, i64 281474976710675] + +// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK24: [[MTYPE22:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659] + +// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK24: [[MTYPE23:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710659, i64 281474976710675] + +// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK24: [[MTYPE24:@.+]] = private {{.*}}constant [4 x i64] [i64 32, i64 281474976710672, i64 16, i64 19] + +// CK24-LABEL: explicit_maps_struct_fields +int explicit_maps_struct_fields(int a){ + SC s; + SC *p; + +// Region 01 +// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) +// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] +// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] +// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + +// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** +// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** +// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] +// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] +// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] +// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0 + +// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** +// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** +// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] +// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]] +// CK24-DAG: store i64 {{.+}}, i64* [[S1]] + +// CK24: call void [[CALL01:@.+]]([[SC]]* {{[^,]+}}) +#pragma omp target map(s.a) + { s.a++; } + +// +// Same thing but starting from a pointer. +// +// Region 13 +// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE13]]{{.+}}, i8** null) +// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] +// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] +// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + +// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** +// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** +// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] +// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] +// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] +// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 0 + +// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** +// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** +// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] +// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]] +// CK24-DAG: store i64 {{.+}}, i64* [[S1]] + +// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} + +// CK24: call void [[CALL13:@.+]]([[SC]]* {{[^,]+}}) +#pragma omp target map(p->a) + { p->a++; } + +// Region 14 +// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE14]]{{.+}}, i8** null) +// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] +// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] +// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + +// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** +// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]** +// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] +// CK24-DAG: store [[SA]]* [[SEC0:%.+]], [[SA]]** [[CP0]] +// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] +// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1 + +// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** +// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]** +// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] +// CK24-DAG: store [[SA]]* [[SEC0]], [[SA]]** [[CP1]] +// CK24-DAG: store i64 {{.+}}, i64* [[S1]] + +// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} + +// CK24: call void [[CALL14:@.+]]([[SC]]* {{[^,]+}}) +#pragma omp target map(p->s.s) + { p->a++; } + +// Region 15 +// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE15]]{{.+}}, i8** null) +// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] +// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] +// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + +// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** +// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** +// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] +// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] +// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] +// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1 + +// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** +// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** +// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] +// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]] +// CK24-DAG: store i64 {{.+}}, i64* [[S1]] + +// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} + +// CK24: call void [[CALL15:@.+]]([[SC]]* {{[^,]+}}) +#pragma omp target map(p->s.s.a) + { p->a++; } + +// Region 16 +// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE16]]{{.+}}, i8** null) +// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] +// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] +// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + +// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** +// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** +// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] +// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] +// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] +// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 3 + +// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** +// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** +// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] +// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]] +// CK24-DAG: store i64 {{.+}}, i64* [[S1]] + +// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} + +// CK24: call void [[CALL16:@.+]]([[SC]]* {{[^,]+}}) +#pragma omp target map(p->b[:5]) + { p->a++; } + +// Region 17 +// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE17]]{{.+}}, i8** null) +// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] +// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] +// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + +// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** +// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]*** +// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] +// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]] +// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] +// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2 + +// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]*** +// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SB]]** +// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]] +// CK24-DAG: store [[SB]]* [[SEC1:%.+]], [[SB]]** [[CP1]] +// CK24-DAG: store i64 {{.+}}, i64* [[S1]] +// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0 +// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]], +// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2 + +// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}} + +// CK24: call void [[CALL17:@.+]]([[SC]]* {{[^,]+}}) +#pragma omp target map(p->p[:5]) + { p->a++; } + +// Region 18 +// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE18]]{{.+}}, i8** null) +// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] +// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] +// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + +// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** +// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** +// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] +// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] +// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] +// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[10 x [[SA]]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3 +// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 2 +// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1 + +// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** +// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** +// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] +// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]] +// CK24-DAG: store i64 {{.+}}, i64* [[S1]] + +// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} + +// CK24: call void [[CALL18:@.+]]([[SC]]* {{[^,]+}}) +#pragma omp target map(p->s.sa[3].a) + { p->a++; } + +// Region 19 +// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE19]]{{.+}}, i8** null) +// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] +// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] +// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + +// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** +// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]*** +// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] +// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]] +// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] +// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 3 +// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3 +// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1 + +// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** +// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]*** +// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] +// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CP1]] +// CK24-DAG: store i64 {{.+}}, i64* [[S1]] + +// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 +// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 +// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]*** +// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** +// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP2]] +// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP2]] +// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]], +// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC1111:%[^,]+]], i{{.+}} 0, i{{.+}} 3 +// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 3 +// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1 + +// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}} + +// CK24: call void [[CALL19:@.+]]([[SC]]* {{[^,]+}}) +#pragma omp target map(p->s.sp[3]->a) + { p->a++; } + +// Region 20 +// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE20]]{{.+}}, i8** null) +// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] +// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] +// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + +// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** +// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]*** +// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] +// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]] +// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] +// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2 + +// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]*** +// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** +// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]] +// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] +// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0 +// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]], +// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2 + +// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}} + +// CK24: call void [[CALL20:@.+]]([[SC]]* {{[^,]+}}) +#pragma omp target map(p->p->a) + { p->a++; } + +// Region 21 +// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE21]]{{.+}}, i8** null) +// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] +// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] +// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + +// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** +// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]*** +// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] +// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]] +// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] +// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 4 +// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1 + +// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** +// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]*** +// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] +// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CP1]] +// CK24-DAG: store i64 {{.+}}, i64* [[S1]] + +// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 +// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 +// CK24-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 +// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]*** +// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** +// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP2]] +// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP2]] +// CK24-DAG: store i64 {{.+}}, i64* [[S2]] +// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0 +// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]], +// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SB]]* [[SEC1111:[^,]+]], i{{.+}} 0, i{{.+}} 4 +// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1 + +// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}} + +// CK24: call void [[CALL21:@.+]]([[SC]]* {{[^,]+}}) +#pragma omp target map(p->s.p->a) + { p->a++; } + +// Region 22 +// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE22]]{{.+}}, i8** null) +// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] +// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] +// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + +// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** +// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** +// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] +// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] +// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] +// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SA]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 2 +// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1 + +// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** +// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** +// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] +// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]] +// CK24-DAG: store i64 {{.+}}, i64* [[S1]] + +// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} + +// CK24: call void [[CALL22:@.+]]([[SC]]* {{[^,]+}}) +#pragma omp target map(p->s.s.b[:2]) + { p->a++; } + +// Region 23 +// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE23]]{{.+}}, i8** null) +// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] +// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] +// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + +// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** +// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]*** +// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] +// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]] +// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] +// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 4 +// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1 + +// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]** +// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]*** +// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]] +// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CP1]] +// CK24-DAG: store i64 {{.+}}, i64* [[S1]] + +// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 +// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 +// CK24-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 +// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]*** +// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** +// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP2]] +// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP2]] +// CK24-DAG: store i64 {{.+}}, i64* [[S2]] +// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[10 x i32]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[SEC11]] = getelementptr {{.*}}[[SA]]* [[SEC111:%[^,]+]], i{{.+}} 0, i{{.+}} 2 +// CK24-DAG: [[SEC111]] = load [[SA]]*, [[SA]]** [[SEC1111:%[^,]+]], +// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 4 +// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1 + +// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}} + +// CK24: call void [[CALL23:@.+]]([[SC]]* {{[^,]+}}) +#pragma omp target map(p->s.p->b[:2]) + { p->a++; } + +// Region 24 +// CK24-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE24]]{{.+}}, i8** null) +// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] +// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] +// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + +// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]** +// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]*** +// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]] +// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]] +// CK24-DAG: store i64 {{%.+}}, i64* [[S0]] +// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2 + +// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]*** +// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]*** +// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]] +// CK24-DAG: store [[SA]]** [[SEC1:%.+]], [[SA]]*** [[CP1]] +// CK24-DAG: store i64 {{.+}}, i64* [[S1]] +// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 4 +// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]], +// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2 + +// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 +// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 +// CK24-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 +// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]*** +// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [[SA]]*** +// CK24-DAG: store [[SA]]** [[SEC1]], [[SA]]*** [[CBP2]] +// CK24-DAG: store [[SA]]** [[SEC2:%.+]], [[SA]]*** [[CP2]] +// CK24-DAG: store i64 {{.+}}, i64* [[S2]] +// CK24-DAG: [[SEC2]] = getelementptr {{.*}}[[SA]]* [[SEC22:%[^,]+]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[SEC22]] = load [[SA]]*, [[SA]]** [[SEC222:%[^,]+]], +// CK24-DAG: [[SEC222]] = getelementptr {{.*}}[[SB]]* [[SEC2222:%[^,]+]], i{{.+}} 0, i{{.+}} 4 +// CK24-DAG: [[SEC2222]] = load [[SB]]*, [[SB]]** [[SEC22222:%[^,]+]], +// CK24-DAG: [[SEC22222]] = getelementptr {{.*}}[[SC]]* [[VAR0000:%.+]], i{{.+}} 0, i{{.+}} 2 + +// CK24-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3 +// CK24-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3 +// CK24-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3 +// CK24-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to [[SA]]*** +// CK24-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i32** +// CK24-DAG: store [[SA]]** [[SEC2]], [[SA]]*** [[CBP3]] +// CK24-DAG: store i32* [[SEC3:%.+]], i32** [[CP3]] +// CK24-DAG: store i64 {{.+}}, i64* [[S3]] +// CK24-DAG: [[SEC3]] = getelementptr {{.*}}[[SA]]* [[SEC33:%[^,]+]], i{{.+}} 0, i{{.+}} 0 +// CK24-DAG: [[SEC33]] = load [[SA]]*, [[SA]]** [[SEC333:%[^,]+]], +// CK24-DAG: [[SEC333]] = getelementptr {{.*}}[[SA]]* [[SEC3333:%[^,]+]], i{{.+}} 0, i{{.+}} 1 +// CK24-DAG: [[SEC3333]] = load [[SA]]*, [[SA]]** [[SEC33333:%[^,]+]], +// CK24-DAG: [[SEC33333]] = getelementptr {{.*}}[[SB]]* [[SEC333333:%[^,]+]], i{{.+}} 0, i{{.+}} 4 +// CK24-DAG: [[SEC333333]] = load [[SB]]*, [[SB]]** [[SEC3333333:%[^,]+]], +// CK24-DAG: [[SEC3333333]] = getelementptr {{.*}}[[SC]]* [[VAR00000:%.+]], i{{.+}} 0, i{{.+}} 2 + +// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR0000]] = load [[SC]]*, [[SC]]** %{{.+}} +// CK24-DAG: [[VAR00000]] = load [[SC]]*, [[SC]]** %{{.+}} + +// CK24: call void [[CALL24:@.+]]([[SC]]* {{[^,]+}}) +#pragma omp target map(p->p->p->p->a) + { p->a++; } + + return s.a; +} + +// CK24: define {{.+}}[[CALL01]] +// CK24: define {{.+}}[[CALL13]] +// CK24: define {{.+}}[[CALL14]] +// CK24: define {{.+}}[[CALL15]] +// CK24: define {{.+}}[[CALL16]] +// CK24: define {{.+}}[[CALL17]] +// CK24: define {{.+}}[[CALL18]] +// CK24: define {{.+}}[[CALL19]] +// CK24: define {{.+}}[[CALL20]] +// CK24: define {{.+}}[[CALL21]] +// CK24: define {{.+}}[[CALL22]] +// CK24: define {{.+}}[[CALL23]] +// CK24: define {{.+}}[[CALL24]] +#endif // CK24 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_24.cpp b/clang/test/OpenMP/target_map_codegen_24.cpp new file mode 100644 index 00000000000000..2fd7bacb8f8403 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_24.cpp @@ -0,0 +1,134 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 +// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 +// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 +// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 + +// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 +// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 +// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 +// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 + +// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 +// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64 +// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 +// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32 + +// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s +// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s +// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s +// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s +// SIMD-ONLY24-NOT: {{__kmpc|__tgt}} +#ifdef CK25 +// CK25: [[ST:%.+]] = type { i32, float } +// CK25: [[CA00:%.+]] = type { [[ST]]* } +// CK25: [[CA01:%.+]] = type { i32* } + +// CK25-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK25: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710657] + +// CK25-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK25: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK25: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 33] + +// CK25-LABEL: explicit_maps_with_inner_lambda{{.*}}( + +template +struct CC { + T A; + float B; + + int foo(T arg) { + // Region 00 + // CK25-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) + // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK25-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK25-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK25-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** + // CK25-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK25-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] + // CK25-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK25-DAG: store i64 {{%.+}}, i64* [[S0]] + // CK25-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0 + + // CK25-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK25-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK25-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK25-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** + // CK25-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK25-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CBP1]] + // CK25-DAG: store i32* [[SEC0]], i32** [[CP1]] + // CK25-DAG: store i64 {{.+}}, i64* [[S1]] + + // CK25: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}}) + #pragma omp target map(to:A) + { + [&]() { + A += 1; + }(); + } + + // Region 01 + // CK25-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) + // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK25-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK25-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK25-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK25-DAG: store i32* [[VAR0]], i32** [[CP0]] + + // CK25: call void [[CALL01:@.+]](i32* {{[^,]+}}) + #pragma omp target map(to:arg) + { + [&]() { + arg += 1; + }(); + } + + return A+arg; + } +}; + +int explicit_maps_with_inner_lambda(int a){ + CC<123,int> c; + return c.foo(a); +} + +// CK25: define {{.+}}[[CALL00]]([[ST]]* [[VAL:%.+]]) +// CK25: store [[ST]]* [[VAL]], [[ST]]** [[VALADDR:%[^,]+]], +// CK25: [[VAL1:%.+]] = load [[ST]]*, [[ST]]** [[VALADDR]], +// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA00]], [[CA00]]* [[CA:%[^,]+]], i32 0, i32 0 +// CK25: store [[ST]]* [[VAL1]], [[ST]]** [[VALADDR1]], +// CK25: call void {{.*}}[[LAMBDA:@.+]]{{.*}}([[CA00]]* [[CA]]) + +// CK25: define {{.+}}[[LAMBDA]] + +// CK25: define {{.+}}[[CALL01]](i32* {{.*}}[[VAL:%.+]]) +// CK25: store i32* [[VAL]], i32** [[VALADDR:%[^,]+]], +// CK25: [[VAL1:%.+]] = load i32*, i32** [[VALADDR]], +// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA01]], [[CA01]]* [[CA:%[^,]+]], i32 0, i32 0 +// CK25: store i32* [[VAL1]], i32** [[VALADDR1]], +// CK25: call void {{.*}}[[LAMBDA2:@.+]]{{.*}}([[CA01]]* [[CA]]) + +// CK25: define {{.+}}[[LAMBDA2]] +#endif // CK25 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_25.cpp b/clang/test/OpenMP/target_map_codegen_25.cpp new file mode 100644 index 00000000000000..6ab8677a5c9fef --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_25.cpp @@ -0,0 +1,223 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-64 +// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-64 +// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-32 +// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-32 + +// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-64 +// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-64 +// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-32 +// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-32 + +// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-64 +// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-64 +// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-32 +// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-32 + +// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY25 %s +// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY25 %s +// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY25 %s +// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY25 %s +// SIMD-ONLY25-NOT: {{__kmpc|__tgt}} +#ifdef CK26 +// CK26: [[ST:%.+]] = type { i32, float*, i32, float* } + +// CK26-LABEL: @.__omp_offloading_{{.*}}CC{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK26: [[SIZE00:@.+]] = private {{.*}}constant [2 x i64] [i64 {{32|16}}, i64 4] +// CK26: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i64] [i64 547, i64 35] + +// CK26-LABEL: @.__omp_offloading_{{.*}}CC{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK26: [[SIZE01:@.+]] = private {{.*}}constant [2 x i64] [i64 {{32|16}}, i64 4] +// CK26: [[MTYPE01:@.+]] = private {{.*}}constant [2 x i64] [i64 547, i64 35] + +// CK26-LABEL: @.__omp_offloading_{{.*}}CC{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK26: [[SIZE02:@.+]] = private {{.*}}constant [2 x i64] [i64 {{32|16}}, i64 4] +// CK26: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i64] [i64 547, i64 35] + +// CK26-LABEL: @.__omp_offloading_{{.*}}CC{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK26: [[SIZE03:@.+]] = private {{.*}}constant [2 x i64] [i64 {{32|16}}, i64 4] +// CK26: [[MTYPE03:@.+]] = private {{.*}}constant [2 x i64] [i64 547, i64 35] + +// CK26-LABEL: explicit_maps_with_private_class_members{{.*}}( + +struct CC { + int fA; + float &fB; + int pA; + float &pB; + + CC(float &B) : fB(B), pB(B) { + + // CK26: call {{.*}}@__kmpc_fork_call{{.*}} [[OUTCALL:@.+]] to void (i32*, i32*, ...)* + // define {{.*}}void [[OUTCALL]] + #pragma omp parallel firstprivate(fA,fB) private(pA,pB) + { + // Region 00 + // CK26-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) + // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** + // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]** + // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] + // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]] + + // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** + // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK26-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] + // CK26-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] + // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]], + // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]], + + // CK26: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}}) + #pragma omp target map(fA) + { + ++fA; + } + + // Region 01 + // CK26-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) + // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** + // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]** + // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] + // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]] + + // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float** + // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float** + // CK26-DAG: store float* [[VAR1:%.+]], float** [[CBP1]] + // CK26-DAG: store float* [[SEC1:%.+]], float** [[CP1]] + // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]], + // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]], + + // CK26: call void [[CALL01:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}}) + #pragma omp target map(fB) + { + fB += 1.0; + } + + // Region 02 + // CK26-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) + // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** + // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]** + // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] + // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]] + + // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** + // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK26-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]] + // CK26-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]] + // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]], + // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]], + + // CK26: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}}) + #pragma omp target map(pA) + { + ++pA; + } + + // Region 01 + // CK26-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE03]]{{.+}}, i8** null) + // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** + // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]** + // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]] + // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]] + + // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float** + // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float** + // CK26-DAG: store float* [[VAR1:%.+]], float** [[CBP1]] + // CK26-DAG: store float* [[SEC1:%.+]], float** [[CP1]] + // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]], + // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]], + + // CK26: call void [[CALL03:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}}) + #pragma omp target map(pB) + { + pB += 1.0; + } + } + } + + int foo() { + return fA + pA; + } +}; + +// Make sure the private instance is used in all target regions. +// CK26: define {{.+}}[[CALL00]]({{.*}}i32*{{.*}}[[PVTARG:%.+]]) +// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]], +// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]], +// CK26: store i32* [[ADDR]], i32** [[PVTADDR:%.+]], +// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]], +// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]], +// CK26: add nsw i32 [[VAL]], 1 + +// CK26: define {{.+}}[[CALL01]]({{.*}}float*{{.*}}[[PVTARG:%.+]]) +// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]], +// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]], +// CK26: store float* [[ADDR]], float** [[PVTADDR:%.+]], +// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]], +// CK26: [[VAL:%.+]] = load float, float* [[ADDR]], +// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double +// CK26: fadd double [[EXT]], 1.000000e+00 + +// CK26: define {{.+}}[[CALL02]]({{.*}}i32*{{.*}}[[PVTARG:%.+]]) +// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]], +// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]], +// CK26: store i32* [[ADDR]], i32** [[PVTADDR:%.+]], +// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]], +// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]], +// CK26: add nsw i32 [[VAL]], 1 + +// CK26: define {{.+}}[[CALL03]]({{.*}}float*{{.*}}[[PVTARG:%.+]]) +// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]], +// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]], +// CK26: store float* [[ADDR]], float** [[PVTADDR:%.+]], +// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]], +// CK26: [[VAL:%.+]] = load float, float* [[ADDR]], +// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double +// CK26: fadd double [[EXT]], 1.000000e+00 + +int explicit_maps_with_private_class_members(){ + float B; + CC c(B); + return c.foo(); +} +#endif // CK26 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_26.cpp b/clang/test/OpenMP/target_map_codegen_26.cpp new file mode 100644 index 00000000000000..9e413c41d290f2 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_26.cpp @@ -0,0 +1,248 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-64 +// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-64 +// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-32 +// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-32 + +// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-64 +// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-64 +// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-32 +// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-32 + +// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-64 +// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-64 +// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-32 +// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-32 + +// RUN: %clang_cc1 -DCK27 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s +// RUN: %clang_cc1 -DCK27 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s +// RUN: %clang_cc1 -DCK27 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s +// RUN: %clang_cc1 -DCK27 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s +// SIMD-ONLY26-NOT: {{__kmpc|__tgt}} +#ifdef CK27 + +// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK27: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] zeroinitializer +// CK27: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 544] + +// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK27: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] zeroinitializer +// CK27: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK27: [[SIZE02:@.+]] = private {{.*}}constant [1 x i64] zeroinitializer +// CK27: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK27: [[SIZE03:@.+]] = private {{.*}}constant [1 x i64] zeroinitializer +// CK27: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK27: [[SIZE05:@.+]] = private {{.*}}constant [1 x i64] zeroinitializer +// CK27: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 32] + +// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK27: [[SIZE07:@.+]] = private {{.*}}constant [1 x i64] [i64 4] +// CK27: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i64] [i64 288] + +// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK27: [[SIZE09:@.+]] = private {{.*}}constant [1 x i64] [i64 40] +// CK27: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 161] + +// CK27-LABEL: zero_size_section_and_private_maps{{.*}}( +void zero_size_section_and_private_maps (int ii){ + + // Map of a pointer. + int *pa; + + // Region 00 + // CK27-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) + // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK27-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK27-DAG: store i32* [[VAR0]], i32** [[CP0]] + + // CK27: call void [[CALL00:@.+]](i32* {{[^,]+}}) + #pragma omp target + { + pa[50]++; + } + + // Region 01 + // CK27-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) + // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] + // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] + // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0 + // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] + + // CK27: call void [[CALL01:@.+]](i32* {{[^,]+}}) + #pragma omp target map(pa[:0]) + { + pa[50]++; + } + + // Region 02 + // CK27-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) + // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] + // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] + // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0 + // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] + + // CK27: call void [[CALL02:@.+]](i32* {{[^,]+}}) + #pragma omp target map(pa[0:0]) + { + pa[50]++; + } + + // Region 03 + // CK27-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}}, i8** null) + // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]] + // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]] + // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]] + // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.+}} + // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]] + + // CK27: call void [[CALL03:@.+]](i32* {{[^,]+}}) + #pragma omp target map(pa[ii:0]) + { + pa[50]++; + } + + int *pvtPtr; + int pvtScl; + int pvtArr[10]; + + // Region 04 + // CK27: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i64* null, i8** null) + // CK27: call void [[CALL04:@.+]]() + #pragma omp target private(pvtPtr) + { + pvtPtr[5]++; + } + + // Region 05 + // CK27-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}}, i8** null) + // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK27-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK27-DAG: store i32* [[VAR0]], i32** [[CP0]] + + // CK27: call void [[CALL05:@.+]](i32* {{[^,]+}}) + #pragma omp target firstprivate(pvtPtr) + { + pvtPtr[5]++; + } + + // Region 06 + // CK27: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i64* null, i8** null) + // CK27: call void [[CALL06:@.+]]() + #pragma omp target private(pvtScl) + { + pvtScl++; + } + + // Region 07 + // CK27-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZE07]]{{.+}}, {{.+}}[[MTYPE07]]{{.+}}, i8** null) + // CK27-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK27-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK27-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK27-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK27-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z:64|32]]* + // CK27-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]* + // CK27-DAG: store i[[Z]] [[VAL:%.+]], i[[Z]]* [[CBP1]] + // CK27-DAG: store i[[Z]] [[VAL]], i[[Z]]* [[CP1]] + // CK27-DAG: [[VAL]] = load i[[Z]], i[[Z]]* [[ADDR:%.+]], + // CK27-64-DAG: [[CADDR:%.+]] = bitcast i[[Z]]* [[ADDR]] to i32* + // CK27-64-DAG: store i32 {{.+}}, i32* [[CADDR]], + + // CK27: call void [[CALL07:@.+]](i[[Z]] [[VAL]]) + #pragma omp target firstprivate(pvtScl) + { + pvtScl++; + } + + // Region 08 + // CK27: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i64* null, i8** null) + // CK27: call void [[CALL08:@.+]]() + #pragma omp target private(pvtArr) + { + pvtArr[5]++; + } + + // Region 09 + // CK27-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}}, i8** null) + // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [10 x i32]** + // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [10 x i32]** + // CK27-DAG: store [10 x i32]* [[VAR0:%.+]], [10 x i32]** [[CBP0]] + // CK27-DAG: store [10 x i32]* [[VAR0]], [10 x i32]** [[CP0]] + + // CK27: call void [[CALL09:@.+]]([10 x i32]* {{[^,]+}}) + #pragma omp target firstprivate(pvtArr) + { + pvtArr[5]++; + } +} + +// CK27: define {{.+}}[[CALL00]] +// CK27: define {{.+}}[[CALL01]] +// CK27: define {{.+}}[[CALL02]] +// CK27: define {{.+}}[[CALL03]] +// CK27: define {{.+}}[[CALL04]] +// CK27: define {{.+}}[[CALL05]] +// CK27: define {{.+}}[[CALL06]] +// CK27: define {{.+}}[[CALL07]] +#endif // CK27 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_27.cpp b/clang/test/OpenMP/target_map_codegen_27.cpp new file mode 100644 index 00000000000000..94ce82988fc4e1 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_27.cpp @@ -0,0 +1,92 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-64 +// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-64 +// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-32 +// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-32 + +// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-64 +// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-64 +// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-32 +// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-32 + +// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-64 +// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-64 +// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-32 +// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-32 + +// RUN: %clang_cc1 -DCK28 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY27 %s +// RUN: %clang_cc1 -DCK28 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY27 %s +// RUN: %clang_cc1 -DCK28 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY27 %s +// RUN: %clang_cc1 -DCK28 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY27 %s +// SIMD-ONLY27-NOT: {{__kmpc|__tgt}} +#ifdef CK28 + +// CK28-LABEL: @.__omp_offloading_{{.*}}explicit_maps_pointer_references{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK28: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] +// CK28: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK28-LABEL: @.__omp_offloading_{{.*}}explicit_maps_pointer_references{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK28: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] [i64 400] +// CK28: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35] + +// CK28-LABEL: explicit_maps_pointer_references{{.*}}( +void explicit_maps_pointer_references (int *p){ + int *&a = p; + + // Region 00 + // CK28-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) + // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK28-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32*** + // CK28-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32*** + // CK28-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]] + // CK28-DAG: store i32** [[VAR1:%.+]], i32*** [[CP0]] + // CK28-DAG: [[VAR0]] = load i32**, i32*** [[VAR00:%.+]], + // CK28-DAG: [[VAR1]] = load i32**, i32*** [[VAR11:%.+]], + + // CK28: call void [[CALL00:@.+]](i32** {{[^,]+}}) + #pragma omp target map(a) + { + ++a; + } + + // Region 01 + // CK28-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) + // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK28-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK28-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK28-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK28-DAG: store i32* [[VAR1:%.+]], i32** [[CP0]] + // CK28-DAG: [[VAR0]] = load i32*, i32** [[VAR00:%.+]], + // CK28-DAG: [[VAR00]] = load i32**, i32*** [[VAR000:%.+]], + // CK28-DAG: [[VAR1]] = getelementptr inbounds i32, i32* [[VAR11:%.+]], i{{64|32}} 2 + // CK28-DAG: [[VAR11]] = load i32*, i32** [[VAR111:%.+]], + // CK28-DAG: [[VAR111]] = load i32**, i32*** [[VAR1111:%.+]], + + // CK28: call void [[CALL01:@.+]](i32* {{[^,]+}}) + #pragma omp target map(a[2:100]) + { + ++a; + } +} +#endif // CK28 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_28.cpp b/clang/test/OpenMP/target_map_codegen_28.cpp new file mode 100644 index 00000000000000..12f19c168375e4 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_28.cpp @@ -0,0 +1,208 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64 +// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64 +// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32 +// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32 + +// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64 +// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64 +// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32 +// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32 + +// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64 +// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64 +// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32 +// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32 + +// RUN: %clang_cc1 -DCK29 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s +// RUN: %clang_cc1 -DCK29 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s +// RUN: %clang_cc1 -DCK29 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s +// RUN: %clang_cc1 -DCK29 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s +// SIMD-ONLY28-NOT: {{__kmpc|__tgt}} +#ifdef CK29 + +// CK29: [[SSA:%.+]] = type { double*, double** } +// CK29: [[SSB:%.+]] = type { [[SSA]]*, [[SSA]]** } + +// CK29-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK29: [[MTYPE00:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710672, i64 19] + +// CK29-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK29: [[MTYPE01:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710672, i64 19] + +// CK29-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK29: [[MTYPE02:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710672, i64 19] + +struct SSA{ + double *p; + double *≺ + SSA(double *&pr) : pr(pr) {} +}; + +struct SSB{ + SSA *p; + SSA *≺ + SSB(SSA *&pr) : pr(pr) {} + + // CK29-LABEL: define {{.+}}foo + void foo() { + + // Region 00 + // CK29-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) + + // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK29-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK29-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]** + // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]** + // CK29-DAG: store [[SSB]]* [[VAR0:%.+]], [[SSB]]** [[CBP0]] + // CK29-DAG: store [[SSA]]** [[VAR00:%.+]], [[SSA]]*** [[CP0]] + // CK29-DAG: store i64 %{{.+}}, i64* [[S0]] + // CK29-DAG: [[VAR0]] = load [[SSB]]*, [[SSB]]** % + // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 0 + + // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK29-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]*** + // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double*** + // CK29-DAG: store [[SSA]]** [[VAR00]], [[SSA]]*** [[CBP1]] + // CK29-DAG: store double** [[VAR1:%.+]], double*** [[CP1]] + // CK29-DAG: store i64 {{8|4}}, i64* [[S1]] + // CK29-DAG: [[VAR1]] = load double**, double*** [[VAR1_REF:%.+]], + // CK29-DAG: [[VAR1_REF]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1 + + // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK29-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 + // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double*** + // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** + // CK29-DAG: store double** [[VAR1]], double*** [[CBP2]] + // CK29-DAG: store double* [[VAR2:%.+]], double** [[CP2]] + // CK29-DAG: store i64 80, i64* [[S2]] + // CK29-DAG: [[VAR2]] = getelementptr inbounds double, double* [[VAR22:%.+]], i{{.+}} 0 + // CK29-DAG: [[VAR22]] = load double*, double** %{{.+}}, + + // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}}) + #pragma omp target map(p->pr[:10]) + { + p->pr++; + } + + // Region 01 + // CK29-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) + + // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK29-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK29-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]** + // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]** + // CK29-DAG: store [[SSB]]* [[VAR0]], [[SSB]]** [[CBP0]] + // CK29-DAG: store [[SSA]]** [[VAR00:%.+]], [[SSA]]*** [[CP0]] + // CK29-DAG: store i64 %{{.+}}, i64* [[S0]] + // CK29-DAG: [[VAR00]] = load [[SSA]]**, [[SSA]]*** [[VAR000:%.+]], + // CK29-DAG: [[VAR000]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1 + + // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK29-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]*** + // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double*** + // CK29-DAG: store [[SSA]]** [[VAR00]], [[SSA]]*** [[CBP1]] + // CK29-DAG: store double** [[VAR1:%.+]], double*** [[CP1]] + // CK29-DAG: store i64 {{8|4}}, i64* [[S1]] + // CK29-DAG: [[VAR1]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 0 + + // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK29-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 + // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double*** + // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** + // CK29-DAG: store double** [[VAR1]], double*** [[CBP2]] + // CK29-DAG: store double* [[VAR2:%.+]], double** [[CP2]] + // CK29-DAG: store i64 80, i64* [[S2]] + // CK29-DAG: [[VAR2]] = getelementptr inbounds double, double* [[VAR22:%.+]], i{{.+}} 0 + // CK29-DAG: [[VAR22]] = load double*, double** %{{.+}}, + + // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}}) + #pragma omp target map(pr->p[:10]) + { + pr->p++; + } + + // Region 02 + // CK29-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE02]]{{.+}}, i8** null) + + // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK29-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK29-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]** + // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]** + // CK29-DAG: store [[SSB]]* [[VAR0]], [[SSB]]** [[CBP0]] + // CK29-DAG: store [[SSA]]** [[VAR00:%.+]], [[SSA]]*** [[CP0]] + // CK29-DAG: store i64 %{{.+}}, i64* [[S0]] + // CK29-DAG: [[VAR00]] = load [[SSA]]**, [[SSA]]*** [[VAR000:%.+]], + // CK29-DAG: [[VAR000]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1 + + // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK29-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]*** + // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double*** + // CK29-DAG: store [[SSA]]** [[VAR00]], [[SSA]]*** [[CBP1]] + // CK29-DAG: store double** [[VAR1:%.+]], double*** [[CP1]] + // CK29-DAG: store i64 {{8|4}}, i64* [[S1]] + // CK29-DAG: [[VAR1]] = load double**, double*** [[VAR1_REF:%.+]], + // CK29-DAG: [[VAR1_REF]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1 + + // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK29-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 + // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double*** + // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** + // CK29-DAG: store double** [[VAR1]], double*** [[CBP2]] + // CK29-DAG: store double* [[VAR2:%.+]], double** [[CP2]] + // CK29-DAG: store i64 80, i64* [[S2]] + // CK29-DAG: [[VAR2]] = getelementptr inbounds double, double* [[VAR22:%.+]], i{{.+}} 0 + // CK29-DAG: [[VAR22]] = load double*, double** %{{.+}}, + + // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}}) + #pragma omp target map(pr->pr[:10]) + { + pr->pr++; + } + } +}; + +void explicit_maps_member_pointer_references(SSA *sap) { + double *d; + SSA sa(d); + SSB sb(sap); + sb.foo(); +} +#endif // CK29 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_29.cpp b/clang/test/OpenMP/target_map_codegen_29.cpp new file mode 100644 index 00000000000000..722136446c6e69 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_29.cpp @@ -0,0 +1,168 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK30 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-64 +// RUN: %clang_cc1 -DCK30 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-64 +// RUN: %clang_cc1 -DCK30 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-32 +// RUN: %clang_cc1 -DCK30 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-32 + +// RUN: %clang_cc1 -DCK30 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-64 +// RUN: %clang_cc1 -DCK30 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-64 +// RUN: %clang_cc1 -DCK30 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-32 +// RUN: %clang_cc1 -DCK30 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-32 + +// RUN: %clang_cc1 -DCK30 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-64 +// RUN: %clang_cc1 -DCK30 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-64 +// RUN: %clang_cc1 -DCK30 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-32 +// RUN: %clang_cc1 -DCK30 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-32 + +// RUN: %clang_cc1 -DCK30 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY30 %s +// RUN: %clang_cc1 -DCK30 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY30 %s +// RUN: %clang_cc1 -DCK30 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY30 %s +// RUN: %clang_cc1 -DCK30 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY30 %s +// SIMD-ONLY30-NOT: {{__kmpc|__tgt}} +#ifdef CK30 + +// CK30-DAG: [[BASE:%.+]] = type { i32*, i32, i32* } +// CK30-DAG: [[STRUCT:%.+]] = type { [[BASE]], i32*, i32*, i32, i32* } + +// CK30-LABEL: @.__omp_offloading_{{.*}}map_with_deep_copy{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// The first element: 0x20 - OMP_MAP_TARGET_PARAM +// 2-4: 0x1000000000003 - OMP_MAP_MEMBER_OF(0) | OMP_MAP_TO | OMP_MAP_FROM - copies all the data in structs excluding deep-copied elements (from &s to &s.ptrBase1, from &s.ptr to &s.ptr1, from &s.ptr1 to end of s). +// 5-6: 0x1000000000013 - OMP_MAP_MEMBER_OF(0) | OMP_MAP_PTR_AND_OBJ | OMP_MAP_TO | OMP_MAP_FROM - deep copy of the pointers + pointee. +// CK30: [[MTYPE00:@.+]] = private {{.*}}constant [6 x i64] [i64 32, i64 281474976710659, i64 281474976710659, i64 281474976710659, i64 281474976710675, i64 281474976710675] + +typedef struct { + int *ptrBase; + int valBase; + int *ptrBase1; +} Base; + +typedef struct StructWithPtrTag : public Base { + int *ptr; + int *ptr2; + int val; + int *ptr1; +} StructWithPtr; + +// CK30-DAG: call i32 @__tgt_target_mapper(i64 -1, i8* @.__omp_offloading_{{.*}}map_with_deep_copy{{.*}}_l{{[0-9]+}}.region_id, i32 6, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], i64* getelementptr inbounds ([6 x i64], [6 x i64]* [[MTYPE00]], i32 0, i32 0), i8** null) +// CK30-DAG: [[GEPS]] = getelementptr inbounds [6 x i{{64|32}}], [6 x i64]* [[SIZES:%.+]], i32 0, i32 0 +// CK30-DAG: [[GEPP]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS:%.+]], i32 0, i32 0 +// CK30-DAG: [[GEPBP]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES:%.+]], i32 0, i32 0 + +// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 0 +// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to [[STRUCT]]** +// CK30-DAG: store [[STRUCT]]* [[S:%.+]], [[STRUCT]]** [[BC]], +// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 0 +// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to [[STRUCT]]** +// CK30-DAG: store [[STRUCT]]* [[S]], [[STRUCT]]** [[BC]], +// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i{{64|32}}], [6 x i64]* [[SIZES]], i32 0, i32 0 +// CK30-DAG: store i64 [[S_ALLOC_SIZE:%.+]], i64* [[SIZE]], +// CK30-DAG: [[S_ALLOC_SIZE]] = sdiv exact i64 [[DIFF:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) +// CK30-DAG: [[DIFF]] = sub i64 [[S_END_BC:%.+]], [[S_BEGIN_BC:%.+]] +// CK30-DAG: [[S_BEGIN_BC]] = ptrtoint i8* [[S_BEGIN:%.+]] to i64 +// CK30-DAG: [[S_END_BC]] = ptrtoint i8* [[S_END:%.+]] to i64 +// CK30-DAG: [[S_BEGIN]] = bitcast [[STRUCT]]* [[S]] to i8* +// CK30-DAG: [[S_END]] = getelementptr i8, i8* [[S_LAST:%.+]], i32 1 +// CK30-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_BC:%.+]], i{{64|32}} {{55|27}} +// CK30-DAG: [[S_BC]] = bitcast [[STRUCT]]* [[S]] to i8* + +// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 1 +// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to [[STRUCT]]** +// CK30-DAG: store [[STRUCT]]* [[S]], [[STRUCT]]** [[BC]], +// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 1 +// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to [[STRUCT]]** +// CK30-DAG: store [[STRUCT]]* [[S]], [[STRUCT]]** [[BC]], +// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i64], [6 x i64]* [[SIZES]], i32 0, i32 1 +// CK30-DAG: store i64 [[SIZE1:%.+]], i64* [[SIZE]], +// CK30-DAG: [[SIZE1]] = sdiv exact i64 [[DIFF:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) +// CK30-DAG: [[DIFF]] = sub i64 [[S_PTRBASE1_BC:%.+]], [[S_BEGIN_BC:%.+]] +// CK30-DAG: [[S_BEGIN_BC]] = ptrtoint i8* [[S_BEGIN:%.+]] to i64 +// CK30-DAG: [[S_PTRBASE1_BC]] = ptrtoint i8* [[S_PTRBASE1:%.+]] to i64 +// CK30-DAG: [[S_PTRBASE1]] = bitcast i32** [[S_PTRBASE1_REF:%.+]] to i8* +// CK30-DAG: [[S_BEGIN]] = bitcast [[STRUCT]]* [[S]] to i8* +// CK30-DAG: [[S_PTRBASE1_REF]] = getelementptr inbounds [[BASE]], [[BASE]]* [[BASE_ADDR:%.+]], i32 0, i32 2 +// CK30-DAG: [[BASE_ADDR]] = bitcast [[STRUCT]]* [[S]] to [[BASE]]* + +// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 2 +// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to [[STRUCT]]** +// CK30-DAG: store [[STRUCT]]* [[S]], [[STRUCT]]** [[BC]], +// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 2 +// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to i32*** +// CK30-DAG: store i32** [[PTR1:%.+]], i32*** [[BC]], +// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i64], [6 x i64]* [[SIZES]], i32 0, i32 2 +// CK30-DAG: store i64 [[SIZE2:%.+]], i64* [[SIZE]], +// CK30-DAG: [[PTR1]] = getelementptr i32*, i32** [[S_PTRBASE1_REF]], i{{64|32}} 1 +// CK30-DAG: [[SIZE2]] = sdiv exact i64 [[DIFF:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) +// CK30-DAG: [[DIFF]] = sub i64 [[S_PTR1_BC:%.+]], [[S_PTRBASE1_BC:%.+]] +// CK30-DAG: [[S_PTR1_BC]] = ptrtoint i8* [[S_PTR1:%.+]] to i64 +// CK30-DAG: [[S_PTRBASE1_BC]] = ptrtoint i8* [[S_PTRBASE1:%.+]] to i64 +// CK30-DAG: [[S_PTR1]] = bitcast i32** [[S_PTR1_REF:%.+]] to i8* +// CK30-DAG: [[S_PTRBASE1]] = bitcast i32** [[PTR1]] to i8* +// CK30-DAG: [[S_PTR1_REF]] = getelementptr inbounds [[STRUCT]], [[STRUCT]]* [[S]], i32 0, i32 4 + +// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 3 +// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to [[STRUCT]]** +// CK30-DAG: store [[STRUCT]]* [[S]], [[STRUCT]]** [[BC]], +// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 3 +// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to i32*** +// CK30-DAG: store i32** [[PTR2:%.+]], i32*** [[BC]], +// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i64], [6 x i64]* [[SIZES]], i32 0, i32 3 +// CK30-DAG: store i64 [[SIZE3:%.+]], i64* [[SIZE]], +// CK30-DAG: [[PTR2]] = getelementptr i32*, i32** [[S_PTR1_REF]], i{{64|32}} 1 +// CK30-DAG: [[SIZE3]] = sdiv exact i64 [[DIFF:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) +// CK30-DAG: [[DIFF]] = sub i64 [[S_END_BC:%.+]], [[S_PTR1_BC:%.+]] +// CK30-DAG: [[S_PTR1_BC]] = ptrtoint i8* [[S_PTR1:%.+]] to i64 +// CK30-DAG: [[S_END_BC]] = ptrtoint i8* [[S_END:%.+]] to i64 +// CK30-DAG: [[S_PTR1]] = bitcast i32** [[PTR2]] to i8* +// CK30-DAG: [[S_END]] = getelementptr i8, i8* [[S_LAST]], i{{64|32}} 1 + +// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 4 +// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to i32*** +// CK30-DAG: store i32** [[S_PTR1:%.+]], i32*** [[BC]], +// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 4 +// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to i32** +// CK30-DAG: store i32* [[S_PTR1_BEGIN:%.+]], i32** [[BC]], +// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i64], [6 x i64]* [[SIZES]], i32 0, i32 4 +// CK30-DAG: store i64 4, i64* [[SIZE]], +// CK30-DAG: [[S_PTR1]] = getelementptr inbounds [[STRUCT]], [[STRUCT]]* [[S]], i32 0, i32 4 +// CK30-DAG: [[S_PTR1_BEGIN]] = getelementptr inbounds i32, i32* [[S_PTR1_BEGIN_REF:%.+]], i{{64|32}} 0 +// CK30-DAG: [[S_PTR1_BEGIN_REF]] = load i32*, i32** [[S_PTR1:%.+]], +// CK30-DAG: [[S_PTR1]] = getelementptr inbounds [[STRUCT]], [[STRUCT]]* [[S]], i32 0, i32 4 + +// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 5 +// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to i32*** +// CK30-DAG: store i32** [[S_PTRBASE1:%.+]], i32*** [[BC]], +// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 5 +// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to i32** +// CK30-DAG: store i32* [[S_PTRBASE1_BEGIN:%.+]], i32** [[BC]], +// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i{{64|32}}], [6 x i{{64|32}}]* [[SIZES]], i32 0, i32 5 +// CK30-DAG: store i{{64|32}} 4, i{{64|32}}* [[SIZE]], +// CK30-DAG: [[S_PTRBASE1]] = getelementptr inbounds [[BASE]], [[BASE]]* [[S_BASE:%.+]], i32 0, i32 2 +// CK30-DAG: [[S_BASE]] = bitcast [[STRUCT]]* [[S]] to [[BASE]]* +// CK30-DAG: [[S_PTRBASE1_BEGIN]] = getelementptr inbounds i32, i32* [[S_PTRBASE1_BEGIN_REF:%.+]], i{{64|32}} 0 +// CK30-DAG: [[S_PTRBASE1_BEGIN_REF]] = load i32*, i32** [[S_PTRBASE1:%.+]], +// CK30-DAG: [[S_PTRBASE1]] = getelementptr inbounds [[BASE]], [[BASE]]* [[S_BASE:%.+]], i32 0, i32 2 +// CK30-DAG: [[S_BASE]] = bitcast [[STRUCT]]* [[S]] to [[BASE]]* +void map_with_deep_copy() { + StructWithPtr s; +#pragma omp target map(s, s.ptr1 [0:1], s.ptrBase1 [0:1]) + { + s.val++; + s.ptr1[0]++; + s.ptrBase1[0] = 10001; + } +} + +#endif // CK30 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_30.cpp b/clang/test/OpenMP/target_map_codegen_30.cpp new file mode 100644 index 00000000000000..56e03c0ae9f904 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_30.cpp @@ -0,0 +1,91 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK31 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-64 +// RUN: %clang_cc1 -DCK31 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-64 +// RUN: %clang_cc1 -DCK31 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-32 +// RUN: %clang_cc1 -DCK31 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-32 + +// RUN: %clang_cc1 -DCK31 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-64 +// RUN: %clang_cc1 -DCK31 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-64 +// RUN: %clang_cc1 -DCK31 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-32 +// RUN: %clang_cc1 -DCK31 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-32 + +// RUN: %clang_cc1 -DCK31 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-64 +// RUN: %clang_cc1 -DCK31 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-64 +// RUN: %clang_cc1 -DCK31 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-32 +// RUN: %clang_cc1 -DCK31 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK31 --check-prefix CK31-32 + +// RUN: %clang_cc1 -DCK31 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DCK31 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DCK31 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DCK31 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// SIMD-ONLY18-NOT: {{__kmpc|__tgt}} +#ifdef CK31 + +// CK31-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK31: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4] +// CK31: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 1059] + +// CK31-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK31: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4] +// CK31: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 1063] + +// CK31-LABEL: explicit_maps_single{{.*}}( +void explicit_maps_single (int ii){ + // Map of a scalar. + int a = ii; + + // Close. + // Region 00 + // CK31-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}, i8** null) + // CK31-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK31-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK31-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK31-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK31-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK31-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK31-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK31-DAG: store i32* [[VAR0]], i32** [[CP0]] + + // CK31: call void [[CALL00:@.+]](i32* {{[^,]+}}) + #pragma omp target map(close, tofrom: a) + { + a++; + } + + // Always Close. + // Region 01 + // CK31-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}, i8** null) + // CK31-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK31-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK31-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK31-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK31-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK31-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK31-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK31-DAG: store i32* [[VAR0]], i32** [[CP0]] + + // CK31: call void [[CALL01:@.+]](i32* {{[^,]+}}) + #pragma omp target map(always close tofrom: a) + { + a++; + } +} +// CK31: define {{.+}}[[CALL00]] +// CK31: define {{.+}}[[CALL01]] + +#endif // CK31 +#endif diff --git a/clang/test/OpenMP/target_map_codegen_31.cpp b/clang/test/OpenMP/target_map_codegen_31.cpp new file mode 100644 index 00000000000000..c649e3340eb489 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_31.cpp @@ -0,0 +1,197 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DUSE -DCK31A -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-64,CK31A-USE +// RUN: %clang_cc1 -DUSE -DCK31A -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-64,CK31A-USE +// RUN: %clang_cc1 -DUSE -DCK31A -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-32,CK31A-USE +// RUN: %clang_cc1 -DUSE -DCK31A -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-32,CK31A-USE + +// RUN: %clang_cc1 -DUSE -DCK31A -verify -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DUSE -DCK31A -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DUSE -DCK31A -verify -fopenmp-version=51 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DUSE -DCK31A -fopenmp-version=51 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s + +// RUN: %clang_cc1 -DCK31A -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-64,CK31A-NOUSE +// RUN: %clang_cc1 -DCK31A -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-64,CK31A-NOUSE +// RUN: %clang_cc1 -DCK31A -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-32,CK31A-NOUSE +// RUN: %clang_cc1 -DCK31A -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31A,CK31A-32,CK31A-NOUSE + +// RUN: %clang_cc1 -DCK31A -verify -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DCK31A -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DCK31A -verify -fopenmp-version=51 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DCK31A -fopenmp-version=51 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// SIMD-ONLY18-NOT: {{__kmpc|__tgt}} +#ifdef CK31A + +// CK31A: [[ST:%.+]] = type { i32, i32 } +struct ST { + int i; + int j; +}; + +// CK31A-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// +// PRESENT=0x1000 | TARGET_PARAM=0x20 = 0x1020 +// CK31A: [[MTYPE00:@.+]] = private {{.*}}constant [7 x i64] [i64 [[#0x1020]], +// +// MEMBER_OF_1=0x1000000000000 | FROM=0x2 | TO=0x1 = 0x1000000000003 +// MEMBER_OF_1=0x1000000000000 | PRESENT=0x1000 | FROM=0x2 | TO=0x1 = 0x1000000001003 +// PRESENT=0x1000 | TARGET_PARAM=0x20 | FROM=0x2 | TO=0x1 = 0x1023 +// CK31A-SAME: {{^}} i64 [[#0x1000000000003]], i64 [[#0x1000000001003]], i64 [[#0x1023]], +// +// PRESENT=0x1000 | TARGET_PARAM=0x20 = 0x1020 +// MEMBER_OF_5=0x5000000000000 | PRESENT=0x1000 | FROM=0x2 | TO=0x1 = 0x5000000001003 +// MEMBER_OF_5=0x5000000000000 | FROM=0x2 | TO=0x1 = 0x5000000000003 +// CK31A-SAME: {{^}} i64 [[#0x1020]], i64 [[#0x5000000001003]], i64 [[#0x5000000000003]]] + +// CK31A-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK31A: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4] +// +// PRESENT=0x1000 | CLOSE=0x400 | TARGET_PARAM=0x20 | ALWAYS=0x4 | FROM=0x2 | TO=0x1 = 0x1427 +// CK31A: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 [[#0x1427]]] + +// CK31A-LABEL: explicit_maps_single{{.*}}( +void explicit_maps_single (int ii){ + // CK31A: alloca i32 + + // Map of a scalar. + // CK31A: [[A:%.+]] = alloca i32 + int a = ii; + + // CK31A: [[ST1:%.+]] = alloca [[ST]] + // CK31A: [[ST2:%.+]] = alloca [[ST]] + struct ST st1; + struct ST st2; + + // Make sure the struct picks up present even if another element of the struct + // doesn't have present. + // Region 00 + // CK31A: [[ST1_I:%.+]] = getelementptr inbounds [[ST]], [[ST]]* [[ST1]], i{{.+}} 0, i{{.+}} 0 + // CK31A: [[ST1_J:%.+]] = getelementptr inbounds [[ST]], [[ST]]* [[ST1]], i{{.+}} 0, i{{.+}} 1 + // CK31A: [[ST2_I:%.+]] = getelementptr inbounds [[ST]], [[ST]]* [[ST2]], i{{.+}} 0, i{{.+}} 0 + // CK31A: [[ST2_J:%.+]] = getelementptr inbounds [[ST]], [[ST]]* [[ST2]], i{{.+}} 0, i{{.+}} 1 + // CK31A-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 7, i8** [[GEPBP:%[0-9]+]], i8** [[GEPP:%[0-9]+]], i64* [[GEPS:%.+]], i64* getelementptr {{.+}}[7 x i{{.+}}]* [[MTYPE00]]{{.+}}) + // CK31A-DAG: [[GEPS]] = getelementptr inbounds [7 x i64], [7 x i64]* [[S:%.+]], i{{.+}} 0, i{{.+}} 0 + // CK31A-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK31A-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // st1 + // CK31A-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK31A-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK31A-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK31A-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** + // CK31A-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK31A-DAG: store [[ST]]* [[ST1]], [[ST]]** [[CBP0]] + // CK31A-DAG: store i32* [[ST1_I]], i32** [[CP0]] + // CK31A-DAG: store i64 %{{.+}}, i64* [[S0]] + + // st1.i + // CK31A-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK31A-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK31A-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK31A-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** + // CK31A-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK31A-DAG: store [[ST]]* [[ST1]], [[ST]]** [[CBP1]] + // CK31A-DAG: store i32* [[ST1_I]], i32** [[CP1]] + // CK31A-DAG: store i64 4, i64* [[S1]] + + // st1.j + // CK31A-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK31A-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK31A-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 + // CK31A-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]** + // CK31A-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** + // CK31A-DAG: store [[ST]]* [[ST1]], [[ST]]** [[CBP2]] + // CK31A-DAG: store i32* [[ST1_J]], i32** [[CP2]] + // CK31A-DAG: store i64 4, i64* [[S2]] + + // a + // CK31A-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3 + // CK31A-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3 + // CK31A-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3 + // CK31A-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to i32** + // CK31A-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i32** + // CK31A-DAG: store i32* [[A]], i32** [[CBP3]] + // CK31A-DAG: store i32* [[A]], i32** [[CP3]] + // CK31A-DAG: store i64 4, i64* [[S3]] + + // st2 + // CK31A-DAG: [[BP4:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 4 + // CK31A-DAG: [[P4:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 4 + // CK31A-DAG: [[S4:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 4 + // CK31A-DAG: [[CBP4:%.+]] = bitcast i8** [[BP4]] to [[ST]]** + // CK31A-DAG: [[CP4:%.+]] = bitcast i8** [[P4]] to i32** + // CK31A-DAG: store [[ST]]* [[ST2]], [[ST]]** [[CBP4]] + // CK31A-DAG: store i32* [[ST2_I]], i32** [[CP4]] + // CK31A-DAG: store i64 %{{.+}}, i64* [[S4]] + + // st2.i + // CK31A-DAG: [[BP5:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 5 + // CK31A-DAG: [[P5:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 5 + // CK31A-DAG: [[S5:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 5 + // CK31A-DAG: [[CBP5:%.+]] = bitcast i8** [[BP5]] to [[ST]]** + // CK31A-DAG: [[CP5:%.+]] = bitcast i8** [[P5]] to i32** + // CK31A-DAG: store [[ST]]* [[ST2]], [[ST]]** [[CBP5]] + // CK31A-DAG: store i32* [[ST2_I]], i32** [[CP5]] + // CK31A-DAG: store i64 4, i64* [[S5]] + + // st2.j + // CK31A-DAG: [[BP6:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 6 + // CK31A-DAG: [[P6:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 6 + // CK31A-DAG: [[S6:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 6 + // CK31A-DAG: [[CBP6:%.+]] = bitcast i8** [[BP6]] to [[ST]]** + // CK31A-DAG: [[CP6:%.+]] = bitcast i8** [[P6]] to i32** + // CK31A-DAG: store [[ST]]* [[ST2]], [[ST]]** [[CBP6]] + // CK31A-DAG: store i32* [[ST2_J]], i32** [[CP6]] + // CK31A-DAG: store i64 4, i64* [[S6]] + + // CK31A-USE: call void [[CALL00:@.+]]([[ST]]* [[ST1]], i32* [[A]], [[ST]]* [[ST2]]) + // CK31A-NOUSE: call void [[CALL00:@.+]]() + #pragma omp target map(tofrom: st1.i) map(present, tofrom: a, st1.j, st2.i) map(tofrom: st2.j) + { +#ifdef USE + st1.i++; + a++; + st1.j++; + st2.i++; + st2.j++; +#endif + } + + // Always Close Present. + // Region 01 + // CK31A-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}) + // CK31A-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK31A-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK31A-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK31A-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK31A-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK31A-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK31A-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK31A-DAG: store i32* [[VAR0]], i32** [[CP0]] + + // CK31A-USE: call void [[CALL01:@.+]](i32* {{[^,]+}}) + // CK31A-NOUSE: call void [[CALL01:@.+]]() + #pragma omp target map(always close present tofrom: a) + { +#ifdef USE + a++; +#endif + } +} +// CK31A: define {{.+}}[[CALL00]] +// CK31A: define {{.+}}[[CALL01]] + +#endif // CK31A +#endif diff --git a/clang/test/OpenMP/target_map_codegen_32.cpp b/clang/test/OpenMP/target_map_codegen_32.cpp new file mode 100644 index 00000000000000..a60629249ee4a9 --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_32.cpp @@ -0,0 +1,111 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DUSE -DCK31B -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-64,CK31B-USE +// RUN: %clang_cc1 -DUSE -DCK31B -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-64,CK31B-USE +// RUN: %clang_cc1 -DUSE -DCK31B -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-32,CK31B-USE +// RUN: %clang_cc1 -DUSE -DCK31B -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-32,CK31B-USE + +// RUN: %clang_cc1 -DUSE -DCK31B -verify -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DUSE -DCK31B -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DUSE -DCK31B -verify -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DUSE -DCK31B -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -DUSE -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s + +// RUN: %clang_cc1 -DCK31B -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-64,CK31B-NOUSE +// RUN: %clang_cc1 -DCK31B -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-64,CK31B-NOUSE +// RUN: %clang_cc1 -DCK31B -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-32,CK31B-NOUSE +// RUN: %clang_cc1 -DCK31B -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefixes=CK31B,CK31B-32,CK31B-NOUSE + +// RUN: %clang_cc1 -DCK31B -verify -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DCK31B -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DCK31B -verify -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DCK31B -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// SIMD-ONLY18-NOT: {{__kmpc|__tgt}} +#ifdef CK31B + +// CK31B: [[ST:%.+]] = type { i32, i32 } + +// PRESENT=0x1000 | TARGET_PARAM=0x20 = 0x1020 +// MEMBER_OF_1=0x1000000000000 | FROM=0x2 | TO=0x1 = 0x1000000000003 +// MEMBER_OF_1=0x1000000000000 | PRESENT=0x1000 | FROM=0x2 | TO=0x1 = 0x1000000001003 + +// CK31B-LABEL: @.__omp_offloading_{{.*}}test_present_members{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK31B: [[MTYPE00:@.+]] = private {{.*}}constant [3 x i64] [i64 [[#0x1020]], +// CK31B-SAME: {{^}} i64 [[#0x1000000000003]], i64 [[#0x1000000001003]]] + +struct ST { + int i; + int j; + // CK31B-LABEL: define {{.*}}test_present_members{{.*}}( + void test_present_members() { + // Make sure the struct picks up present even if another element of the + // struct doesn't have present. + // Region 00 + // CK31B: [[I:%.+]] = getelementptr inbounds [[ST]], [[ST]]* [[THIS:%.+]], i{{.+}} 0, i{{.+}} 0 + // CK31B: [[J:%.+]] = getelementptr inbounds [[ST]], [[ST]]* [[THIS]], i{{.+}} 0, i{{.+}} 1 + // CK31B-DAG: call i32 @__tgt_target_mapper(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%[0-9]+]], i8** [[GEPP:%[0-9]+]], i64* [[GEPS:%.+]], i64* getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE00]]{{.+}}) + // CK31B-DAG: [[GEPS]] = getelementptr inbounds [3 x i64], [3 x i64]* [[S:%.+]], i{{.+}} 0, i{{.+}} 0 + // CK31B-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK31B-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // this + // CK31B-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK31B-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK31B-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + // CK31B-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]** + // CK31B-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK31B-DAG: store [[ST]]* [[THIS]], [[ST]]** [[CBP0]] + // CK31B-DAG: store i32* [[I]], i32** [[CP0]] + // CK31B-DAG: store i64 %{{.+}}, i64* [[S0]] + + // i + // CK31B-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 + // CK31B-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 + // CK31B-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 + // CK31B-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** + // CK31B-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK31B-DAG: store [[ST]]* [[THIS]], [[ST]]** [[CBP1]] + // CK31B-DAG: store i32* [[I]], i32** [[CP1]] + // CK31B-DAG: store i64 4, i64* [[S1]] + + // j + // CK31B-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 + // CK31B-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 + // CK31B-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 + // CK31B-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]** + // CK31B-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32** + // CK31B-DAG: store [[ST]]* [[THIS]], [[ST]]** [[CBP2]] + // CK31B-DAG: store i32* [[J]], i32** [[CP2]] + // CK31B-DAG: store i64 4, i64* [[S2]] + + // CK31B-USE: call void [[CALL00:@.+]]([[ST]]* [[THIS]]) + // CK31B-NOUSE: call void [[CALL00:@.+]]() + #pragma omp target map(tofrom: i) map(present, tofrom: j) + { +#ifdef USE + i++; + j++; +#endif + } + } +}; + +void test() { + ST s; + s.test_present_members(); +} + +// CK31B: define {{.+}}[[CALL00]] + +#endif // CK31B +#endif diff --git a/clang/test/OpenMP/target_map_codegen_33.cpp b/clang/test/OpenMP/target_map_codegen_33.cpp new file mode 100644 index 00000000000000..ef74b9860ba12e --- /dev/null +++ b/clang/test/OpenMP/target_map_codegen_33.cpp @@ -0,0 +1,81 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==========================================================================/// +// RUN: %clang_cc1 -DCK32 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK32 --check-prefix CK32-64 +// RUN: %clang_cc1 -DCK32 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK32 --check-prefix CK32-64 +// RUN: %clang_cc1 -DCK32 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK32 --check-prefix CK32-32 +// RUN: %clang_cc1 -DCK32 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK32 --check-prefix CK32-32 + +// RUN: %clang_cc1 -DCK32 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY32 %s +// RUN: %clang_cc1 -DCK32 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY32 %s +// RUN: %clang_cc1 -DCK32 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY32 %s +// RUN: %clang_cc1 -DCK32 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY32 %s +// SIMD-ONLY32-NOT: {{__kmpc|__tgt}} +#ifdef CK32 + +// CK32-DAG: [[MTYPE_TO:@.+]] = {{.+}}constant [1 x i64] [i64 33] +// CK32-DAG: [[MTYPE_FROM:@.+]] = {{.+}}constant [1 x i64] [i64 34] + +void array_shaping(float *f, int sa) { + + // CK32-DAG: call i32 @__tgt_target_mapper(i64 -1, i8* @{{.+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE_TO]]{{.+}}, i8** null) + // CK32-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK32-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK32-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK32-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK32-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK32-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + + // CK32-DAG: [[BPC0:%.+]] = bitcast i8** [[BP0]] to float** + // CK32-DAG: [[PC0:%.+]] = bitcast i8** [[P0]] to float** + + // CK32-DAG: store float* [[F1:%.+]], float** [[BPC0]], + // CK32-DAG: store float* [[F2:%.+]], float** [[PC0]], + // CK32-DAG: store i64 [[SIZE:%.+]], i64* [[S0]], + + // CK32-DAG: [[F1]] = load float*, float** [[F_ADDR:%.+]], + // CK32-DAG: [[F2]] = load float*, float** [[F_ADDR]], + // CK32-64-DAG: [[SIZE]] = mul nuw i64 [[SZ1:%.+]], 4 + // CK32-64-DAG: [[SZ1]] = mul nuw i64 12, %{{.+}} + // CK32-32-DAG: [[SIZE]] = sext i32 [[SZ1:%.+]] to i64 + // CK32-32-DAG: [[SZ1]] = mul nuw i32 [[SZ2:%.+]], 4 + // CK32-32-DAG: [[SZ2]] = mul nuw i32 12, %{{.+}} + #pragma omp target map(to:([3][sa][4])f) + f[0] = 1; + sa = 1; + // CK32-DAG: call i32 @__tgt_target_mapper(i64 -1, i8* @{{.+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE_FROM]]{{.+}}, i8** null) + // CK32-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK32-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + // CK32-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] + + // CK32-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK32-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK32-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 + + // CK32-DAG: [[BPC0:%.+]] = bitcast i8** [[BP0]] to float** + // CK32-DAG: [[PC0:%.+]] = bitcast i8** [[P0]] to float** + + // CK32-DAG: store float* [[F1:%.+]], float** [[BPC0]], + // CK32-DAG: store float* [[F2:%.+]], float** [[PC0]], + // CK32-DAG: store i64 [[SIZE:%.+]], i64* [[S0]], + + // CK32-DAG: [[F1]] = load float*, float** [[F_ADDR:%.+]], + // CK32-DAG: [[F2]] = load float*, float** [[F_ADDR]], + // CK32-64-DAG: [[SIZE]] = mul nuw i64 [[SZ1:%.+]], 5 + // CK32-64-DAG: [[SZ1]] = mul nuw i64 4, %{{.+}} + // CK32-32-DAG: [[SIZE]] = sext i32 [[SZ1:%.+]] to i64 + // CK32-32-DAG: [[SZ1]] = mul nuw i32 [[SZ2:%.+]], 5 + // CK32-32-DAG: [[SZ2]] = mul nuw i32 4, %{{.+}} + #pragma omp target map(from: ([sa][5])f) + f[0] = 1; +} + +#endif // CK32 +#endif From 660832c4e744108ecb45b697e51be72482cacd42 Mon Sep 17 00:00:00 2001 From: Kiran Chandramohan Date: Fri, 7 Aug 2020 18:33:46 +0000 Subject: [PATCH 18/26] [OpenMP,MLIR] Translation of parallel operation: num_threads, if clauses 3/n This simple patch translates the num_threads and if clauses of the parallel operation. Also includes test cases. A minor change was made to parsing of the if clause to parse AnyType and return the parsed type. Updates to test cases also. Reviewed by: SouraVX Differential Revision: https://reviews.llvm.org/D84798 --- mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp | 13 ++- mlir/lib/Target/LLVMIR/ModuleTranslation.cpp | 5 + mlir/test/Dialect/OpenMP/invalid.mlir | 2 +- mlir/test/Dialect/OpenMP/ops.mlir | 4 +- mlir/test/Target/openmp-llvm.mlir | 97 ++++++++++++++++++++ 5 files changed, 111 insertions(+), 10 deletions(-) diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp index 9159e87509c672..217588289e8513 100644 --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -69,7 +69,7 @@ static void printParallelOp(OpAsmPrinter &p, ParallelOp op) { p << "omp.parallel"; if (auto ifCond = op.if_expr_var()) - p << " if(" << ifCond << ")"; + p << " if(" << ifCond << " : " << ifCond.getType() << ")"; if (auto threads = op.num_threads_var()) p << " num_threads(" << threads << " : " << threads.getType() << ")"; @@ -124,7 +124,7 @@ static ParseResult allowedOnce(OpAsmParser &parser, llvm::StringRef clause, /// Note that each clause can only appear once in the clase-list. static ParseResult parseParallelOp(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType ifCond; + std::pair ifCond; std::pair numThreads; llvm::SmallVector privates; llvm::SmallVector privateTypes; @@ -152,8 +152,8 @@ static ParseResult parseParallelOp(OpAsmParser &parser, // Fail if there was already another if condition if (segments[ifClausePos]) return allowedOnce(parser, "if", opName); - if (parser.parseLParen() || parser.parseOperand(ifCond) || - parser.parseRParen()) + if (parser.parseLParen() || parser.parseOperand(ifCond.first) || + parser.parseColonType(ifCond.second) || parser.parseRParen()) return failure(); segments[ifClausePos] = 1; } else if (keyword == "num_threads") { @@ -209,7 +209,7 @@ static ParseResult parseParallelOp(OpAsmParser &parser, auto attr = parser.getBuilder().getStringAttr(attrval); result.addAttribute("default_val", attr); } else if (keyword == "proc_bind") { - // fail if there was already another default clause + // fail if there was already another proc_bind clause if (procBind) return allowedOnce(parser, "proc_bind", opName); procBind = true; @@ -228,8 +228,7 @@ static ParseResult parseParallelOp(OpAsmParser &parser, // Add if parameter if (segments[ifClausePos]) { - parser.resolveOperand(ifCond, parser.getBuilder().getI1Type(), - result.operands); + parser.resolveOperand(ifCond.first, ifCond.second, result.operands); } // Add num_threads parameter diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp index f58d02845ccd2e..b3b7e4c7afa53a 100644 --- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp @@ -454,7 +454,12 @@ ModuleTranslation::convertOmpParallel(Operation &opInst, // TODO: The various operands of parallel operation are not handled. // Parallel operation is created with some default options for now. llvm::Value *ifCond = nullptr; + if (auto ifExprVar = cast(opInst).if_expr_var()) + ifCond = valueMapping.lookup(ifExprVar); llvm::Value *numThreads = nullptr; + if (auto numThreadsVar = cast(opInst).num_threads_var()) + numThreads = valueMapping.lookup(numThreadsVar); + // TODO: Is the Parallel construct cancellable? bool isCancellable = false; // TODO: Determine the actual alloca insertion point, e.g., the function // entry or the alloca insertion point as provided by the body callback diff --git a/mlir/test/Dialect/OpenMP/invalid.mlir b/mlir/test/Dialect/OpenMP/invalid.mlir index 00f9726b119dd3..88f61e7f791694 100644 --- a/mlir/test/Dialect/OpenMP/invalid.mlir +++ b/mlir/test/Dialect/OpenMP/invalid.mlir @@ -12,7 +12,7 @@ func @unknown_clause() { func @if_once(%n : i1) { // expected-error@+1 {{at most one if clause can appear on the omp.parallel operation}} - omp.parallel if(%n) if(%n) { + omp.parallel if(%n : i1) if(%n : i1) { } return diff --git a/mlir/test/Dialect/OpenMP/ops.mlir b/mlir/test/Dialect/OpenMP/ops.mlir index 85343f9855011b..e3e7afaff54163 100644 --- a/mlir/test/Dialect/OpenMP/ops.mlir +++ b/mlir/test/Dialect/OpenMP/ops.mlir @@ -99,14 +99,14 @@ func @omp_parallel_pretty(%data_var : memref, %if_cond : i1, %num_threads : // CHECK omp.parallel shared(%{{.*}} : memref) copyin(%{{.*}} : memref, %{{.*}} : memref) omp.parallel shared(%data_var : memref) copyin(%data_var : memref, %data_var : memref) { - omp.parallel if(%if_cond) { + omp.parallel if(%if_cond: i1) { omp.terminator } omp.terminator } // CHECK omp.parallel if(%{{.*}}) num_threads(%{{.*}} : si32) private(%{{.*}} : memref) proc_bind(close) - omp.parallel num_threads(%num_threads : si32) if(%if_cond) + omp.parallel num_threads(%num_threads : si32) if(%if_cond: i1) private(%data_var : memref) proc_bind(close) { omp.terminator } diff --git a/mlir/test/Target/openmp-llvm.mlir b/mlir/test/Target/openmp-llvm.mlir index c8acd8022b2bf1..60462fee3b97b6 100644 --- a/mlir/test/Target/openmp-llvm.mlir +++ b/mlir/test/Target/openmp-llvm.mlir @@ -78,3 +78,100 @@ llvm.func @test_omp_parallel_2() -> () { // CHECK-LABEL: omp.par.region2: // CHECK: call void @body(i64 43) // CHECK: br label %omp.par.pre_finalize + +// CHECK: define void @test_omp_parallel_num_threads_1(i32 %[[NUM_THREADS_VAR_1:.*]]) +llvm.func @test_omp_parallel_num_threads_1(%arg0: !llvm.i32) -> () { + // CHECK: %[[GTN_NUM_THREADS_VAR_1:.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @[[GTN_SI_VAR_1:.*]]) + // CHECK: call void @__kmpc_push_num_threads(%struct.ident_t* @[[GTN_SI_VAR_1]], i32 %[[GTN_NUM_THREADS_VAR_1]], i32 %[[NUM_THREADS_VAR_1]]) + // CHECK: call void{{.*}}@__kmpc_fork_call{{.*}}@[[OMP_OUTLINED_FN_NUM_THREADS_1:.*]] to {{.*}} + omp.parallel num_threads(%arg0: !llvm.i32) { + omp.barrier + omp.terminator + } + + llvm.return +} + +// CHECK: define internal void @[[OMP_OUTLINED_FN_NUM_THREADS_1]] + // CHECK: call void @__kmpc_barrier + +// CHECK: define void @test_omp_parallel_num_threads_2() +llvm.func @test_omp_parallel_num_threads_2() -> () { + %0 = llvm.mlir.constant(4 : index) : !llvm.i32 + // CHECK: %[[GTN_NUM_THREADS_VAR_2:.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @[[GTN_SI_VAR_2:.*]]) + // CHECK: call void @__kmpc_push_num_threads(%struct.ident_t* @[[GTN_SI_VAR_2]], i32 %[[GTN_NUM_THREADS_VAR_2]], i32 4) + // CHECK: call void{{.*}}@__kmpc_fork_call{{.*}}@[[OMP_OUTLINED_FN_NUM_THREADS_2:.*]] to {{.*}} + omp.parallel num_threads(%0: !llvm.i32) { + omp.barrier + omp.terminator + } + + llvm.return +} + +// CHECK: define internal void @[[OMP_OUTLINED_FN_NUM_THREADS_2]] + // CHECK: call void @__kmpc_barrier + +// CHECK: define void @test_omp_parallel_num_threads_3() +llvm.func @test_omp_parallel_num_threads_3() -> () { + %0 = llvm.mlir.constant(4 : index) : !llvm.i32 + // CHECK: %[[GTN_NUM_THREADS_VAR_3_1:.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @[[GTN_SI_VAR_3_1:.*]]) + // CHECK: call void @__kmpc_push_num_threads(%struct.ident_t* @[[GTN_SI_VAR_3_1]], i32 %[[GTN_NUM_THREADS_VAR_3_1]], i32 4) + // CHECK: call void{{.*}}@__kmpc_fork_call{{.*}}@[[OMP_OUTLINED_FN_NUM_THREADS_3_1:.*]] to {{.*}} + omp.parallel num_threads(%0: !llvm.i32) { + omp.barrier + omp.terminator + } + %1 = llvm.mlir.constant(8 : index) : !llvm.i32 + // CHECK: %[[GTN_NUM_THREADS_VAR_3_2:.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @[[GTN_SI_VAR_3_2:.*]]) + // CHECK: call void @__kmpc_push_num_threads(%struct.ident_t* @[[GTN_SI_VAR_3_2]], i32 %[[GTN_NUM_THREADS_VAR_3_2]], i32 8) + // CHECK: call void{{.*}}@__kmpc_fork_call{{.*}}@[[OMP_OUTLINED_FN_NUM_THREADS_3_2:.*]] to {{.*}} + omp.parallel num_threads(%1: !llvm.i32) { + omp.barrier + omp.terminator + } + + llvm.return +} + +// CHECK: define internal void @[[OMP_OUTLINED_FN_NUM_THREADS_3_2]] + // CHECK: call void @__kmpc_barrier + +// CHECK: define internal void @[[OMP_OUTLINED_FN_NUM_THREADS_3_1]] + // CHECK: call void @__kmpc_barrier + +// CHECK: define void @test_omp_parallel_if_1(i32 %[[IF_VAR_1:.*]]) +llvm.func @test_omp_parallel_if_1(%arg0: !llvm.i32) -> () { + +// CHECK: %[[IF_COND_VAR_1:.*]] = icmp slt i32 %[[IF_VAR_1]], 0 + %0 = llvm.mlir.constant(0 : index) : !llvm.i32 + %1 = llvm.icmp "slt" %arg0, %0 : !llvm.i32 + +// CHECK: %[[GTN_IF_1:.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @[[SI_VAR_IF_1:.*]]) +// CHECK: br i1 %[[IF_COND_VAR_1]], label %[[IF_COND_TRUE_BLOCK_1:.*]], label %[[IF_COND_FALSE_BLOCK_1:.*]] +// CHECK: [[IF_COND_TRUE_BLOCK_1]]: +// CHECK: br label %[[OUTLINED_CALL_IF_BLOCK_1:.*]] +// CHECK: [[OUTLINED_CALL_IF_BLOCK_1]]: +// CHECK: call void {{.*}} @__kmpc_fork_call(%struct.ident_t* @[[SI_VAR_IF_1]], {{.*}} @[[OMP_OUTLINED_FN_IF_1:.*]] to void +// CHECK: br label %[[OUTLINED_EXIT_IF_1:.*]] +// CHECK: [[OUTLINED_EXIT_IF_1]]: +// CHECK: br label %[[OUTLINED_EXIT_IF_2:.*]] +// CHECK: [[OUTLINED_EXIT_IF_2]]: +// CHECK: br label %[[RETURN_BLOCK_IF_1:.*]] +// CHECK: [[IF_COND_FALSE_BLOCK_1]]: +// CHECK: call void @__kmpc_serialized_parallel(%struct.ident_t* @[[SI_VAR_IF_1]], i32 %[[GTN_IF_1]]) +// CHECK: call void @[[OMP_OUTLINED_FN_IF_1]] +// CHECK: call void @__kmpc_end_serialized_parallel(%struct.ident_t* @[[SI_VAR_IF_1]], i32 %[[GTN_IF_1]]) +// CHECK: br label %[[RETURN_BLOCK_IF_1]] + omp.parallel if(%1 : !llvm.i1) { + omp.barrier + omp.terminator + } + +// CHECK: [[RETURN_BLOCK_IF_1]]: +// CHECK: ret void + llvm.return +} + +// CHECK: define internal void @[[OMP_OUTLINED_FN_IF_1]] + // CHECK: call void @__kmpc_barrier From 7d4996033bc57c5fa4153a0191ed48f4d287f48c Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Fri, 7 Aug 2020 13:58:10 -0700 Subject: [PATCH 19/26] [StackSafety,NFC] Add Stats counters --- llvm/lib/Analysis/StackSafetyAnalysis.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/llvm/lib/Analysis/StackSafetyAnalysis.cpp b/llvm/lib/Analysis/StackSafetyAnalysis.cpp index 042062a449c90c..0e2c44607e0521 100644 --- a/llvm/lib/Analysis/StackSafetyAnalysis.cpp +++ b/llvm/lib/Analysis/StackSafetyAnalysis.cpp @@ -45,6 +45,10 @@ STATISTIC(NumModuleCalleeLookupTotal, "Number of total callee lookups on module index."); STATISTIC(NumModuleCalleeLookupFailed, "Number of failed callee lookups on module index."); +STATISTIC(NumCombinedParamAccessesBefore, + "Number of total param accesses before generateParamAccessSummary."); +STATISTIC(NumCombinedParamAccessesAfter, + "Number of total param accesses after generateParamAccessSummary."); static cl::opt StackSafetyMaxIterations("stack-safety-max-iterations", cl::init(20), cl::Hidden); @@ -936,6 +940,18 @@ void llvm::generateParamAccessSummary(ModuleSummaryIndex &Index) { if (!Index.hasParamAccess()) return; const ConstantRange FullSet(FunctionSummary::ParamAccess::RangeWidth, true); + + auto CountParamAccesses = [&](StatisticBase &Counter) { + if (!AreStatisticsEnabled()) + return; + for (auto &GVS : Index) + for (auto &GV : GVS.second.SummaryList) + if (FunctionSummary *FS = dyn_cast(GV.get())) + NumCombinedParamAccessesAfter += FS->paramAccesses().size(); + }; + + CountParamAccesses(NumCombinedParamAccessesBefore); + std::map> Functions; // Convert the ModuleSummaryIndex to a FunctionMap @@ -988,6 +1004,8 @@ void llvm::generateParamAccessSummary(ModuleSummaryIndex &Index) { const_cast(KV.first)->setParamAccesses( std::move(NewParams)); } + + CountParamAccesses(NumCombinedParamAccessesAfter); } static const char LocalPassArg[] = "stack-safety-local"; From 7547508b7ae0985bde2b2cbba953f87e5c30e242 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Fri, 7 Aug 2020 13:59:22 -0700 Subject: [PATCH 20/26] Revert "[StackSafety] Skip ambiguous lifetime analysis" This reverts commit 0b2616a8045cb776ea1514c3401d0a8577de1060. Crashes with safe-stack. --- llvm/include/llvm/Analysis/StackLifetime.h | 2 - llvm/lib/Analysis/StackLifetime.cpp | 58 +++++++++--------- .../Analysis/StackSafetyAnalysis/lifetime.ll | 59 +------------------ llvm/test/CodeGen/AArch64/stack-tagging.ll | 11 ++-- 4 files changed, 37 insertions(+), 93 deletions(-) diff --git a/llvm/include/llvm/Analysis/StackLifetime.h b/llvm/include/llvm/Analysis/StackLifetime.h index 1c0e10368dafdb..8abc6cc1ce00fe 100644 --- a/llvm/include/llvm/Analysis/StackLifetime.h +++ b/llvm/include/llvm/Analysis/StackLifetime.h @@ -121,8 +121,6 @@ class StackLifetime { DenseMap, 4>> BBMarkers; - bool HasUnknownLifetimeStartOrEnd = false; - void dumpAllocas() const; void dumpBlockLiveness() const; void dumpLiveRanges() const; diff --git a/llvm/lib/Analysis/StackLifetime.cpp b/llvm/lib/Analysis/StackLifetime.cpp index d953a876260852..9727b7a33d1fbf 100644 --- a/llvm/lib/Analysis/StackLifetime.cpp +++ b/llvm/lib/Analysis/StackLifetime.cpp @@ -11,7 +11,6 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" -#include "llvm/Analysis/ValueTracking.h" #include "llvm/Config/llvm-config.h" #include "llvm/IR/AssemblyAnnotationWriter.h" #include "llvm/IR/BasicBlock.h" @@ -64,27 +63,42 @@ bool StackLifetime::isAliveAfter(const AllocaInst *AI, return getLiveRange(AI).test(InstNum); } +static bool readMarker(const Instruction *I, bool *IsStart) { + if (!I->isLifetimeStartOrEnd()) + return false; + + auto *II = cast(I); + *IsStart = II->getIntrinsicID() == Intrinsic::lifetime_start; + return true; +} + void StackLifetime::collectMarkers() { InterestingAllocas.resize(NumAllocas); DenseMap> BBMarkerSet; // Compute the set of start/end markers per basic block. - for (const BasicBlock *BB : depth_first(&F)) { - for (const Instruction &I : *BB) { - const IntrinsicInst *II = dyn_cast(&I); - if (!II || !II->isLifetimeStartOrEnd()) - continue; - const AllocaInst *AI = llvm::findAllocaForValue(II->getArgOperand(1)); - if (!AI) { - HasUnknownLifetimeStartOrEnd = true; - continue; + for (unsigned AllocaNo = 0; AllocaNo < NumAllocas; ++AllocaNo) { + const AllocaInst *AI = Allocas[AllocaNo]; + SmallVector WorkList; + WorkList.push_back(AI); + while (!WorkList.empty()) { + const Instruction *I = WorkList.pop_back_val(); + for (const User *U : I->users()) { + if (auto *BI = dyn_cast(U)) { + WorkList.push_back(BI); + continue; + } + auto *UI = dyn_cast(U); + if (!UI) + continue; + bool IsStart; + if (!readMarker(UI, &IsStart)) + continue; + if (IsStart) + InterestingAllocas.set(AllocaNo); + BBMarkerSet[UI->getParent()][UI] = {AllocaNo, IsStart}; } - bool IsStart = II->getIntrinsicID() == Intrinsic::lifetime_start; - unsigned AllocaNo = AllocaNumbering[AI]; - if (IsStart) - InterestingAllocas.set(AllocaNo); - BBMarkerSet[BB][II] = {AllocaNo, IsStart}; } } @@ -290,20 +304,6 @@ StackLifetime::StackLifetime(const Function &F, } void StackLifetime::run() { - if (HasUnknownLifetimeStartOrEnd) { - // There is marker which we can't assign to a specific alloca, so we - // fallback to the most conservative results for the type. - switch (Type) { - case LivenessType::May: - LiveRanges.resize(NumAllocas, getFullLiveRange()); - break; - case LivenessType::Must: - LiveRanges.resize(NumAllocas, LiveRange(Instructions.size())); - break; - } - return; - } - LiveRanges.resize(NumAllocas, LiveRange(Instructions.size())); for (unsigned I = 0; I < NumAllocas; ++I) if (!InterestingAllocas.test(I)) diff --git a/llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll b/llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll index 470450a3a977de..1c7eeb5ac69c2b 100644 --- a/llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll +++ b/llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll @@ -742,7 +742,7 @@ if.end: ; MAY-NEXT: Alive: ; MUST-NEXT: Alive: - ret void +ret void } define void @unreachable() { @@ -778,62 +778,7 @@ end: ; CHECK: end: ; CHECK-NEXT: Alive: - ret void -} - -define void @non_alloca(i8* %p) { -; CHECK-LABEL: define void @non_alloca -entry: -; CHECK: entry: -; MAY-NEXT: Alive: -; MUST-NEXT: Alive: <> - %x = alloca i8, align 4 - %y = alloca i8, align 4 - - call void @llvm.lifetime.start.p0i8(i64 4, i8* %p) -; CHECK: call void @llvm.lifetime.start.p0i8(i64 4, i8* %p) -; MAY-NEXT: Alive: -; MUST-NEXT: Alive: <> - - call void @llvm.lifetime.start.p0i8(i64 4, i8* %x) -; CHECK: call void @llvm.lifetime.start.p0i8(i64 4, i8* %x) -; MAY-NEXT: Alive: -; MUST-NEXT: Alive: <> - - call void @llvm.lifetime.end.p0i8(i64 4, i8* %p) -; CHECK: call void @llvm.lifetime.end.p0i8(i64 4, i8* %p) -; MAY-NEXT: Alive: -; MUST-NEXT: Alive: <> - - ret void -} - -define void @select_alloca(i1 %v) { -; CHECK-LABEL: define void @select_alloca -entry: -; CHECK: entry: -; MAY-NEXT: Alive: -; MUST-NEXT: Alive: <> - %x = alloca i8, align 4 - %y = alloca i8, align 4 - %cxcy = select i1 %v, i8* %x, i8* %y - - call void @llvm.lifetime.start.p0i8(i64 1, i8* %cxcy) -; CHECK: call void @llvm.lifetime.start.p0i8(i64 1, i8* %cxcy) -; MAY-NEXT: Alive: -; MUST-NEXT: Alive: <> - - call void @llvm.lifetime.start.p0i8(i64 1, i8* %x) -; CHECK: call void @llvm.lifetime.start.p0i8(i64 1, i8* %x) -; MAY-NEXT: Alive: -; MUST-NEXT: Alive: <> - - call void @llvm.lifetime.end.p0i8(i64 1, i8* %x) -; CHECK: call void @llvm.lifetime.end.p0i8(i64 1, i8* %x) -; MAY-NEXT: Alive: -; MUST-NEXT: Alive: <> - - ret void +ret void } declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) diff --git a/llvm/test/CodeGen/AArch64/stack-tagging.ll b/llvm/test/CodeGen/AArch64/stack-tagging.ll index 83fe4025ea0c9f..275b8a7dbad7e1 100644 --- a/llvm/test/CodeGen/AArch64/stack-tagging.ll +++ b/llvm/test/CodeGen/AArch64/stack-tagging.ll @@ -192,9 +192,10 @@ another_bb: ; CHECK: alloca { i32, [12 x i8] }, align 16 ; CHECK: call { i32, [12 x i8] }* @llvm.aarch64.tagp ; CHECK: call void @llvm.aarch64.settag( -; CHECK: alloca { i32, [12 x i8] }, align 16 -; CHECK: call { i32, [12 x i8] }* @llvm.aarch64.tagp -; CHECK: call void @llvm.aarch64.settag( +; SSI: alloca i32, align 4 +; NOSSI: alloca { i32, [12 x i8] }, align 16 +; NOSSI: call { i32, [12 x i8] }* @llvm.aarch64.tagp +; NOSSI: call void @llvm.aarch64.settag( ; CHECK: store i32 ; CHECK: call void @noUse32(i32* ; CHECK: store i32 @@ -202,7 +203,7 @@ another_bb: ; CHECK: call void @noUse32(i32* ; CHECK: call void @llvm.aarch64.settag( ; CHECK: call void @llvm.aarch64.settag( -; CHECK: call void @llvm.aarch64.settag( +; NOSSI: call void @llvm.aarch64.settag( ; CHECK: ret void -!0 = !{} +!0 = !{} \ No newline at end of file From 645de3664a6b85c0f7ac56194fb2fe0e6a233c0b Mon Sep 17 00:00:00 2001 From: Sameer Arora Date: Fri, 31 Jul 2020 11:52:47 -0700 Subject: [PATCH 21/26] [llvm-libtool-darwin] Add constant CPU_SUBTYPE_ARM64_V8 Add support for constant MachO::CPU_SUBTYPE_ARM64_V8. This constant is needed so as to match `llvm-libtool-darwin`'s behavior to that of cctools' libtool when `-arch_only` flag is passed in on command line. Reviewed by jhenderson, alexshap, smeenai Differential Revision: https://reviews.llvm.org/D85041 --- llvm/include/llvm/BinaryFormat/MachO.h | 1 + .../MachO/AArch64/macho-arm64-subtypes.test | 26 ++++++ .../MachO/AArch64/macho-arm64e.test | 6 -- .../llvm-objdump/MachO/universal-arm64.test | 85 +++++++++++++++++++ .../MachO/file-headers-arm64.test | 43 ++++++++++ llvm/tools/llvm-objdump/MachODump.cpp | 7 ++ llvm/tools/llvm-readobj/MachODumper.cpp | 5 +- 7 files changed, 165 insertions(+), 8 deletions(-) create mode 100644 llvm/test/tools/llvm-objdump/MachO/AArch64/macho-arm64-subtypes.test delete mode 100644 llvm/test/tools/llvm-objdump/MachO/AArch64/macho-arm64e.test create mode 100644 llvm/test/tools/llvm-objdump/MachO/universal-arm64.test create mode 100644 llvm/test/tools/llvm-readobj/MachO/file-headers-arm64.test diff --git a/llvm/include/llvm/BinaryFormat/MachO.h b/llvm/include/llvm/BinaryFormat/MachO.h index e43fea0a2465ef..dc8d10f6129b96 100644 --- a/llvm/include/llvm/BinaryFormat/MachO.h +++ b/llvm/include/llvm/BinaryFormat/MachO.h @@ -1492,6 +1492,7 @@ enum CPUSubTypeARM { enum CPUSubTypeARM64 { CPU_SUBTYPE_ARM64_ALL = 0, + CPU_SUBTYPE_ARM64_V8 = 1, CPU_SUBTYPE_ARM64E = 2, }; diff --git a/llvm/test/tools/llvm-objdump/MachO/AArch64/macho-arm64-subtypes.test b/llvm/test/tools/llvm-objdump/MachO/AArch64/macho-arm64-subtypes.test new file mode 100644 index 00000000000000..b295d8f08824a7 --- /dev/null +++ b/llvm/test/tools/llvm-objdump/MachO/AArch64/macho-arm64-subtypes.test @@ -0,0 +1,26 @@ +# RUN: yaml2obj %s -o %tarm64-all.o -DSUBTYPE=0x0 +# RUN: llvm-objdump -p %tarm64-all.o | FileCheck --strict-whitespace %s --check-prefixes="COMMON,ALL" + +# RUN: yaml2obj %s -o %tarm64-v8.o -DSUBTYPE=0x1 +# RUN: llvm-objdump -p %tarm64-v8.o | FileCheck --strict-whitespace %s --check-prefixes="COMMON,V8" + +# RUN: yaml2obj %s -o %tarm64e.o -DSUBTYPE=0x2 +# RUN: llvm-objdump -p %tarm64e.o | FileCheck --strict-whitespace %s --check-prefixes="COMMON,E" + +# COMMON: Mach header +# COMMON-NEXT: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags +# ALL-NEXT: MH_MAGIC_64 ARM64 ALL 0x00 OBJECT 0 0 0x00000000 +# V8-NEXT: MH_MAGIC_64 ARM64 V8 0x00 OBJECT 0 0 0x00000000 +# E-NEXT: MH_MAGIC_64 ARM64 E 0x00 OBJECT 0 0 0x00000000 + +--- !mach-o +FileHeader: + magic: 0xFEEDFACF + cputype: 0x0100000C + cpusubtype: [[SUBTYPE]] + filetype: 0x00000001 + ncmds: 0 + sizeofcmds: 0 + flags: 0x00000000 + reserved: 0x00000000 +... diff --git a/llvm/test/tools/llvm-objdump/MachO/AArch64/macho-arm64e.test b/llvm/test/tools/llvm-objdump/MachO/AArch64/macho-arm64e.test deleted file mode 100644 index e40a96b770e208..00000000000000 --- a/llvm/test/tools/llvm-objdump/MachO/AArch64/macho-arm64e.test +++ /dev/null @@ -1,6 +0,0 @@ -// RUN: yaml2obj %p/Inputs/arm64e.macho.yaml -o %tarm64e.o -// RUN: llvm-objdump -p %tarm64e.o | FileCheck --strict-whitespace %s - -CHECK: Mach header -CHECK-NEXT: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags -CHECK-NEXT: MH_MAGIC_64 ARM64 E 0x00 OBJECT 0 0 0x00000000 diff --git a/llvm/test/tools/llvm-objdump/MachO/universal-arm64.test b/llvm/test/tools/llvm-objdump/MachO/universal-arm64.test new file mode 100644 index 00000000000000..bcd841eff785d4 --- /dev/null +++ b/llvm/test/tools/llvm-objdump/MachO/universal-arm64.test @@ -0,0 +1,85 @@ +## This test checks that the CPUTypes are printed correctly for the subtypes of +## ARM64. + +# RUN: yaml2obj %s -o %tarm.o +# RUN: llvm-objdump %tarm.o --universal-headers --macho | \ +# RUN: FileCheck %s --match-full-lines + +# CHECK: Fat headers +# CHECK-NEXT: fat_magic FAT_MAGIC +# CHECK-NEXT: nfat_arch 3 +# CHECK-NEXT: architecture arm64 +# CHECK-NEXT: cputype CPU_TYPE_ARM64 +# CHECK-NEXT: cpusubtype CPU_SUBTYPE_ARM64_ALL +# CHECK-NEXT: capabilities 0x0 +# CHECK-NEXT: offset 4096 +# CHECK-NEXT: size 352 +# CHECK-NEXT: align 2^12 (4096) +# CHECK-NEXT: architecture +# CHECK-NEXT: cputype CPU_TYPE_ARM64 +# CHECK-NEXT: cpusubtype CPU_SUBTYPE_ARM64_V8 +# CHECK-NEXT: capabilities 0x0 +# CHECK-NEXT: offset 16384 +# CHECK-NEXT: size 384 +# CHECK-NEXT: align 2^14 (16384) +# CHECK-NEXT: architecture +# CHECK-NEXT: cputype CPU_TYPE_ARM64 +# CHECK-NEXT: cpusubtype CPU_SUBTYPE_ARM64E +# CHECK-NEXT: capabilities 0x0 +# CHECK-NEXT: offset 28672 +# CHECK-NEXT: size 384 +# CHECK-NEXT: align 2^12 (4096) +# CHECK-NOT:{{.}} + +--- !fat-mach-o +FatHeader: + magic: 0xCAFEBABE + nfat_arch: 3 +FatArchs: + - cputype: 0x0100000C + cpusubtype: 0x00000000 + offset: 0x0000000000001000 + size: 352 + align: 12 + - cputype: 0x0100000C + cpusubtype: 0x00000001 + offset: 0x0000000000004000 + size: 384 + align: 14 + - cputype: 0x0100000C + cpusubtype: 0x00000002 + offset: 0x0000000000007000 + size: 384 + align: 12 +Slices: + - !mach-o + FileHeader: + magic: 0xFEEDFACF + cputype: 0x0100000C + cpusubtype: 0x00000000 + filetype: 0x00000001 + ncmds: 0 + sizeofcmds: 0 + flags: 0x00000000 + reserved: 0x00000000 + - !mach-o + FileHeader: + magic: 0xFEEDFACF + cputype: 0x0100000C + cpusubtype: 0x00000001 + filetype: 0x00000001 + ncmds: 0 + sizeofcmds: 0 + flags: 0x00000000 + reserved: 0x00000000 + - !mach-o + FileHeader: + magic: 0xFEEDFACF + cputype: 0x0100000C + cpusubtype: 0x00000002 + filetype: 0x00000001 + ncmds: 0 + sizeofcmds: 0 + flags: 0x00000000 + reserved: 0x00000000 +... diff --git a/llvm/test/tools/llvm-readobj/MachO/file-headers-arm64.test b/llvm/test/tools/llvm-readobj/MachO/file-headers-arm64.test new file mode 100644 index 00000000000000..910ee019f3293b --- /dev/null +++ b/llvm/test/tools/llvm-readobj/MachO/file-headers-arm64.test @@ -0,0 +1,43 @@ +## Check subtype Arm64-ALL: +# RUN: yaml2obj %s -o %t.arm64-all -DSUBTYPE=0x0 +# RUN: llvm-readobj -h %t.arm64-all \ +# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.arm64-all --check-prefix=ARM64 -DSUBTYPE="CPU_SUBTYPE_ARM64_ALL (0x0)" + +## Check subtype Arm64-V8: +# RUN: yaml2obj %s -o %t.arm64-v8 -DSUBTYPE=0x1 +# RUN: llvm-readobj -h %t.arm64-v8 \ +# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.arm64-v8 --check-prefix=ARM64 -DSUBTYPE="CPU_SUBTYPE_ARM64_V8 (0x1)" + +## Check subtype Arm64E: +# RUN: yaml2obj %s -o %t.arm64e -DSUBTYPE=0x2 +# RUN: llvm-readobj -h %t.arm64e \ +# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.arm64e --check-prefix=ARM64 -DSUBTYPE="CPU_SUBTYPE_ARM64E (0x2)" + +# ARM64:File: [[FILE]] +# ARM64-NEXT:Format: Mach-O arm64 +# ARM64-NEXT:Arch: aarch64 +# ARM64-NEXT:AddressSize: 64bit +# ARM64-NEXT:MachHeader { +# ARM64-NEXT: Magic: Magic64 (0xFEEDFACF) +# ARM64-NEXT: CpuType: Arm64 (0x100000C) +# ARM64-NEXT: CpuSubType: [[SUBTYPE]] +# ARM64-NEXT: FileType: Relocatable (0x1) +# ARM64-NEXT: NumOfLoadCommands: 0 +# ARM64-NEXT: SizeOfLoadCommands: 0 +# ARM64-NEXT: Flags [ (0x0) +# ARM64-NEXT: ] +# ARM64-NEXT: Reserved: 0x0 +# ARM64-NEXT:} +# ARM64-NOT:{{.}} + +--- !mach-o +FileHeader: + magic: 0xFEEDFACF + cputype: 0x0100000C + cpusubtype: [[SUBTYPE]] + filetype: 0x00000001 + ncmds: 0 + sizeofcmds: 0 + flags: 0x00000000 + reserved: 0x00000000 +... diff --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp index 6d46496ecd4ea7..22096c22471496 100644 --- a/llvm/tools/llvm-objdump/MachODump.cpp +++ b/llvm/tools/llvm-objdump/MachODump.cpp @@ -2109,6 +2109,10 @@ static void printCPUType(uint32_t cputype, uint32_t cpusubtype) { outs() << " cputype CPU_TYPE_ARM64\n"; outs() << " cpusubtype CPU_SUBTYPE_ARM64_ALL\n"; break; + case MachO::CPU_SUBTYPE_ARM64_V8: + outs() << " cputype CPU_TYPE_ARM64\n"; + outs() << " cpusubtype CPU_SUBTYPE_ARM64_V8\n"; + break; case MachO::CPU_SUBTYPE_ARM64E: outs() << " cputype CPU_TYPE_ARM64\n"; outs() << " cpusubtype CPU_SUBTYPE_ARM64E\n"; @@ -8315,6 +8319,9 @@ static void PrintMachHeader(uint32_t magic, uint32_t cputype, case MachO::CPU_SUBTYPE_ARM64_ALL: outs() << " ALL"; break; + case MachO::CPU_SUBTYPE_ARM64_V8: + outs() << " V8"; + break; case MachO::CPU_SUBTYPE_ARM64E: outs() << " E"; break; diff --git a/llvm/tools/llvm-readobj/MachODumper.cpp b/llvm/tools/llvm-readobj/MachODumper.cpp index 20a60b3df69936..ae8e1bdd2be6b1 100644 --- a/llvm/tools/llvm-readobj/MachODumper.cpp +++ b/llvm/tools/llvm-readobj/MachODumper.cpp @@ -161,8 +161,9 @@ static const EnumEntry MachOHeaderCpuSubtypesARM[] = { }; static const EnumEntry MachOHeaderCpuSubtypesARM64[] = { - LLVM_READOBJ_ENUM_ENT(MachO, CPU_SUBTYPE_ARM64_ALL), - LLVM_READOBJ_ENUM_ENT(MachO, CPU_SUBTYPE_ARM64E), + LLVM_READOBJ_ENUM_ENT(MachO, CPU_SUBTYPE_ARM64_ALL), + LLVM_READOBJ_ENUM_ENT(MachO, CPU_SUBTYPE_ARM64_V8), + LLVM_READOBJ_ENUM_ENT(MachO, CPU_SUBTYPE_ARM64E), }; static const EnumEntry MachOHeaderCpuSubtypesSPARC[] = { From e486921fd6cf96ae9114adac455f7c0b5c1088a7 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Fri, 7 Aug 2020 14:10:04 -0700 Subject: [PATCH 22/26] [Clang] implement -fno-eliminate-unused-debug-types Fixes pr/11710. Signed-off-by: Nick Desaulniers Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D80242 --- clang/docs/ClangCommandLineReference.rst | 4 ++ clang/docs/CommandGuide/clang.rst | 6 +++ clang/docs/UsersManual.rst | 6 +++ clang/include/clang/Basic/CodeGenOptions.def | 3 +- clang/include/clang/Basic/CodeGenOptions.h | 5 ++ clang/include/clang/Basic/DebugInfoOptions.h | 6 ++- clang/include/clang/Driver/Options.td | 3 +- clang/lib/CodeGen/CGDebugInfo.cpp | 15 ++++-- clang/lib/CodeGen/CGDebugInfo.h | 3 ++ clang/lib/CodeGen/CGDecl.cpp | 19 ++++--- clang/lib/CodeGen/CodeGenModule.cpp | 32 ++++++++++-- clang/lib/Driver/ToolChains/Clang.cpp | 13 ++++- clang/lib/Frontend/CompilerInvocation.cpp | 1 + clang/test/CodeGen/debug-info-unused-types.c | 50 +++++++++++++++++++ .../test/CodeGen/debug-info-unused-types.cpp | 31 ++++++++++++ clang/test/Driver/debug-options.c | 9 ++++ 16 files changed, 185 insertions(+), 21 deletions(-) create mode 100644 clang/test/CodeGen/debug-info-unused-types.c create mode 100644 clang/test/CodeGen/debug-info-unused-types.cpp diff --git a/clang/docs/ClangCommandLineReference.rst b/clang/docs/ClangCommandLineReference.rst index 4caa08a82a72e1..370f13d6c95597 100644 --- a/clang/docs/ClangCommandLineReference.rst +++ b/clang/docs/ClangCommandLineReference.rst @@ -2154,6 +2154,10 @@ Emit section containing metadata on function stack sizes Emit full debug info for all types used by the program +.. option:: -feliminate-unused-debug-types, -fno-eliminate-unused-debug-types + +Suppress (or emit) debug info for types that are unused but defined by the program. + .. option:: -fstrict-aliasing, -fno-strict-aliasing .. option:: -fstrict-enums, -fno-strict-enums diff --git a/clang/docs/CommandGuide/clang.rst b/clang/docs/CommandGuide/clang.rst index 2cca04fb31f1a5..394bd1be24e870 100644 --- a/clang/docs/CommandGuide/clang.rst +++ b/clang/docs/CommandGuide/clang.rst @@ -433,6 +433,12 @@ Code Generation Options never emit type information for types that are not referenced at all by the program. +.. option:: -feliminate-unused-debug-types + + By default, Clang does not emit type information for types that are defined + but not used in a program. To retain the debug info for these unused types, + the negation **-fno-eliminate-unused-debug-types** can be used. + .. option:: -fexceptions Enable generation of unwind information. This allows exceptions to be thrown diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst index 8615a77596b4f3..19009b43a9e8d8 100644 --- a/clang/docs/UsersManual.rst +++ b/clang/docs/UsersManual.rst @@ -2352,6 +2352,12 @@ below. If multiple flags are present, the last one is used. Generate complete debug info. +.. option:: -feliminate-unused-debug-types + + By default, Clang does not emit type information for types that are defined + but not used in a program. To retain the debug info for these unused types, + the negation **-fno-eliminate-unused-debug-types** can be used. + Controlling Macro Debug Info Generation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def index c7e01eb1285188..cbd9df998e7865 100644 --- a/clang/include/clang/Basic/CodeGenOptions.def +++ b/clang/include/clang/Basic/CodeGenOptions.def @@ -288,7 +288,6 @@ CODEGENOPT(DebugFwdTemplateParams, 1, 0) ///< Whether to emit complete ///< template parameter descriptions in ///< forward declarations (versus just ///< including them in the name). - CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize use-lists. CODEGENOPT(WholeProgramVTables, 1, 0) ///< Whether to apply whole-program @@ -313,7 +312,7 @@ VALUE_CODEGENOPT(SmallDataLimit, 32, 0) VALUE_CODEGENOPT(SSPBufferSize, 32, 0) /// The kind of generated debug info. -ENUM_CODEGENOPT(DebugInfo, codegenoptions::DebugInfoKind, 3, codegenoptions::NoDebugInfo) +ENUM_CODEGENOPT(DebugInfo, codegenoptions::DebugInfoKind, 4, codegenoptions::NoDebugInfo) /// Whether to generate macro debug info. CODEGENOPT(MacroDebugInfo, 1, 0) diff --git a/clang/include/clang/Basic/CodeGenOptions.h b/clang/include/clang/Basic/CodeGenOptions.h index 83c4463c36394f..ca391bf8f1861c 100644 --- a/clang/include/clang/Basic/CodeGenOptions.h +++ b/clang/include/clang/Basic/CodeGenOptions.h @@ -388,6 +388,11 @@ class CodeGenOptions : public CodeGenOptionsBase { bool hasReducedDebugInfo() const { return getDebugInfo() >= codegenoptions::DebugInfoConstructor; } + + /// Check if maybe unused type info should be emitted. + bool hasMaybeUnusedDebugInfo() const { + return getDebugInfo() >= codegenoptions::UnusedTypeInfo; + } }; } // end namespace clang diff --git a/clang/include/clang/Basic/DebugInfoOptions.h b/clang/include/clang/Basic/DebugInfoOptions.h index 586168bd015f83..7f5669c1760fdc 100644 --- a/clang/include/clang/Basic/DebugInfoOptions.h +++ b/clang/include/clang/Basic/DebugInfoOptions.h @@ -46,7 +46,11 @@ enum DebugInfoKind { LimitedDebugInfo, /// Generate complete debug info. - FullDebugInfo + FullDebugInfo, + + /// Generate debug info for types that may be unused in the source + /// (-fno-eliminate-unused-debug-types). + UnusedTypeInfo, }; } // end namespace codegenoptions diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index fc31c23e4240fa..e09b6468eea76a 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -943,6 +943,8 @@ def fno_elide_type : Flag<["-"], "fno-elide-type">, Group, Flags<[CC1Option]>, HelpText<"Do not elide types when printing diagnostics">; def feliminate_unused_debug_symbols : Flag<["-"], "feliminate-unused-debug-symbols">, Group; +defm eliminate_unused_debug_types : OptOutFFlag<"eliminate-unused-debug-types", + "Do not emit ", "Emit ", " debug info for defined but unused types">; def femit_all_decls : Flag<["-"], "femit-all-decls">, Group, Flags<[CC1Option]>, HelpText<"Emit all declarations, even if unused">; def femulated_tls : Flag<["-"], "femulated-tls">, Group, Flags<[CC1Option]>, @@ -3321,7 +3323,6 @@ def fdiagnostics_show_location_EQ : Joined<["-"], "fdiagnostics-show-location="> defm fcheck_new : BooleanFFlag<"check-new">, Group; defm caller_saves : BooleanFFlag<"caller-saves">, Group; defm reorder_blocks : BooleanFFlag<"reorder-blocks">, Group; -defm eliminate_unused_debug_types : BooleanFFlag<"eliminate-unused-debug-types">, Group; defm branch_count_reg : BooleanFFlag<"branch-count-reg">, Group; defm default_inline : BooleanFFlag<"default-inline">, Group; defm fat_lto_objects : BooleanFFlag<"fat-lto-objects">, Group; diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 461f2eee965d2e..2faf944d07d13a 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -606,6 +606,7 @@ void CGDebugInfo::CreateCompileUnit() { case codegenoptions::DebugInfoConstructor: case codegenoptions::LimitedDebugInfo: case codegenoptions::FullDebugInfo: + case codegenoptions::UnusedTypeInfo: EmissionKind = llvm::DICompileUnit::FullDebug; break; } @@ -4960,13 +4961,17 @@ void CGDebugInfo::finalize() { DBuilder.finalize(); } +// Don't ignore in case of explicit cast where it is referenced indirectly. void CGDebugInfo::EmitExplicitCastType(QualType Ty) { - if (!CGM.getCodeGenOpts().hasReducedDebugInfo()) - return; + if (CGM.getCodeGenOpts().hasReducedDebugInfo()) + if (auto *DieTy = getOrCreateType(Ty, TheCU->getFile())) + DBuilder.retainType(DieTy); +} - if (auto *DieTy = getOrCreateType(Ty, TheCU->getFile())) - // Don't ignore in case of explicit cast where it is referenced indirectly. - DBuilder.retainType(DieTy); +void CGDebugInfo::EmitAndRetainType(QualType Ty) { + if (CGM.getCodeGenOpts().hasMaybeUnusedDebugInfo()) + if (auto *DieTy = getOrCreateType(Ty, TheCU->getFile())) + DBuilder.retainType(DieTy); } llvm::DebugLoc CGDebugInfo::SourceLocToDebugLoc(SourceLocation Loc) { diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index 96ef6c7c1d27d8..59fe7929ef880c 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -490,6 +490,9 @@ class CGDebugInfo { /// Emit the type explicitly casted to. void EmitExplicitCastType(QualType Ty); + /// Emit the type even if it might not be used. + void EmitAndRetainType(QualType Ty); + /// Emit C++ using declaration. void EmitUsingDecl(const UsingDecl &UD); diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 1729c7ed3c310a..0ad5050fabbb42 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -100,11 +100,19 @@ void CodeGenFunction::EmitDecl(const Decl &D) { case Decl::ObjCTypeParam: case Decl::Binding: llvm_unreachable("Declaration should not be in declstmts!"); - case Decl::Function: // void X(); case Decl::Record: // struct/union/class X; + case Decl::CXXRecord: // struct/union/class X; [C++] + if (CGDebugInfo *DI = getDebugInfo()) + if (cast(D).getDefinition()) + DI->EmitAndRetainType(getContext().getRecordType(cast(&D))); + return; case Decl::Enum: // enum X; + if (CGDebugInfo *DI = getDebugInfo()) + if (cast(D).getDefinition()) + DI->EmitAndRetainType(getContext().getEnumType(cast(&D))); + return; + case Decl::Function: // void X(); case Decl::EnumConstant: // enum ? { X = ? } - case Decl::CXXRecord: // struct/union/class X; [C++] case Decl::StaticAssert: // static_assert(X, ""); [C++0x] case Decl::Label: // __label__ x; case Decl::Import: @@ -157,12 +165,11 @@ void CodeGenFunction::EmitDecl(const Decl &D) { case Decl::Typedef: // typedef int X; case Decl::TypeAlias: { // using X = int; [C++0x] - const TypedefNameDecl &TD = cast(D); - QualType Ty = TD.getUnderlyingType(); - + QualType Ty = cast(D).getUnderlyingType(); + if (CGDebugInfo *DI = getDebugInfo()) + DI->EmitAndRetainType(Ty); if (Ty->isVariablyModifiedType()) EmitVariablyModifiedType(Ty); - return; } } diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index f3712ea1f541d8..67f06ac1c07c18 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -5392,16 +5392,21 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { Spec->hasDefinition()) DI->completeTemplateDefinition(*Spec); } LLVM_FALLTHROUGH; - case Decl::CXXRecord: - if (CGDebugInfo *DI = getModuleDebugInfo()) + case Decl::CXXRecord: { + CXXRecordDecl *CRD = cast(D); + if (CGDebugInfo *DI = getModuleDebugInfo()) { + if (CRD->hasDefinition()) + DI->EmitAndRetainType(getContext().getRecordType(cast(D))); if (auto *ES = D->getASTContext().getExternalSource()) if (ES->hasExternalDefinitions(D) == ExternalASTSource::EK_Never) - DI->completeUnusedClass(cast(*D)); + DI->completeUnusedClass(*CRD); + } // Emit any static data members, they may be definitions. - for (auto *I : cast(D)->decls()) + for (auto *I : CRD->decls()) if (isa(I) || isa(I)) EmitTopLevelDecl(I); break; + } // No code generation needed. case Decl::UsingShadow: case Decl::ClassTemplate: @@ -5587,6 +5592,25 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { EmitOMPRequiresDecl(cast(D)); break; + case Decl::Typedef: + case Decl::TypeAlias: // using foo = bar; [C++11] + if (CGDebugInfo *DI = getModuleDebugInfo()) + DI->EmitAndRetainType( + getContext().getTypedefType(cast(D))); + break; + + case Decl::Record: + if (CGDebugInfo *DI = getModuleDebugInfo()) + if (cast(D)->getDefinition()) + DI->EmitAndRetainType(getContext().getRecordType(cast(D))); + break; + + case Decl::Enum: + if (CGDebugInfo *DI = getModuleDebugInfo()) + if (cast(D)->getDefinition()) + DI->EmitAndRetainType(getContext().getEnumType(cast(D))); + break; + default: // Make sure we handled everything we should, every other kind is a // non-top-level decl. FIXME: Would be nice to have an isTopLevelDeclKind diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 68e4eb0eedda1d..ff252998e6f5e7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -976,6 +976,9 @@ static void RenderDebugEnablingArgs(const ArgList &Args, ArgStringList &CmdArgs, case codegenoptions::FullDebugInfo: CmdArgs.push_back("-debug-info-kind=standalone"); break; + case codegenoptions::UnusedTypeInfo: + CmdArgs.push_back("-debug-info-kind=unused-types"); + break; default: break; } @@ -3781,8 +3784,14 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D, TC.GetDefaultStandaloneDebug()); if (const Arg *A = Args.getLastArg(options::OPT_fstandalone_debug)) (void)checkDebugInfoOption(A, Args, D, TC); - if (DebugInfoKind == codegenoptions::LimitedDebugInfo && NeedFullDebug) - DebugInfoKind = codegenoptions::FullDebugInfo; + + if (DebugInfoKind == codegenoptions::LimitedDebugInfo) { + if (Args.hasFlag(options::OPT_fno_eliminate_unused_debug_types, + options::OPT_feliminate_unused_debug_types, false)) + DebugInfoKind = codegenoptions::UnusedTypeInfo; + else if (NeedFullDebug) + DebugInfoKind = codegenoptions::FullDebugInfo; + } if (Args.hasFlag(options::OPT_gembed_source, options::OPT_gno_embed_source, false)) { diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 8e8bf9d9028ebb..c3c8f3b9c6a94f 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -767,6 +767,7 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, .Case("constructor", codegenoptions::DebugInfoConstructor) .Case("limited", codegenoptions::LimitedDebugInfo) .Case("standalone", codegenoptions::FullDebugInfo) + .Case("unused-types", codegenoptions::UnusedTypeInfo) .Default(~0U); if (Val == ~0U) Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) diff --git a/clang/test/CodeGen/debug-info-unused-types.c b/clang/test/CodeGen/debug-info-unused-types.c new file mode 100644 index 00000000000000..9ecd394118081b --- /dev/null +++ b/clang/test/CodeGen/debug-info-unused-types.c @@ -0,0 +1,50 @@ +// RUN: %clang -fno-eliminate-unused-debug-types -g -emit-llvm -S -o - %s | FileCheck %s +// RUN: %clang -fno-eliminate-unused-debug-types -g1 -emit-llvm -S -o - %s | FileCheck --check-prefix=NODBG %s +// RUN: %clang -feliminate-unused-debug-types -g -emit-llvm -S -o - %s | FileCheck --check-prefix=NODBG %s +// RUN: %clang -g -emit-llvm -S -o - %s | FileCheck --check-prefix=NODBG %s +// RUN: %clang -emit-llvm -S -o - %s | FileCheck --check-prefix=NODBG %s +typedef int my_int; +struct foo {}; +enum bar { BAR }; +union baz {}; + +void quux(void) { + typedef int x; + struct y {}; + enum z { Z }; + union w {}; +} + +// Check that debug info is emitted for the typedef, struct, enum, and union +// when -fno-eliminate-unused-debug-types and -g are set. + +// CHECK: !DICompileUnit{{.+}}retainedTypes: [[RETTYPES:![0-9]+]] +// CHECK: [[TYPE0:![0-9]+]] = !DICompositeType(tag: DW_TAG_enumeration_type, name: "bar" +// CHECK: [[TYPE1:![0-9]+]] = !DIEnumerator(name: "BAR" +// CHECK: [[TYPE2:![0-9]+]] = !DICompositeType(tag: DW_TAG_enumeration_type, name: "z" +// CHECK: [[TYPE3:![0-9]+]] = !DIEnumerator(name: "Z" +// CHECK: [[RETTYPES]] = !{[[TYPE4:![0-9]+]], [[TYPE5:![0-9]+]], [[TYPE0]], [[TYPE6:![0-9]+]], !17, [[TYPE7:![0-9]+]], [[TYPE2]], [[TYPE8:![0-9]+]]} +// CHECK: [[TYPE4]] = !DIDerivedType(tag: DW_TAG_typedef, name: "my_int" +// CHECK: [[TYPE5]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "foo" +// CHECK: [[TYPE6]] = distinct !DICompositeType(tag: DW_TAG_union_type, name: "baz" +// CHECK: [[TYPE7]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "y" +// CHECK: [[TYPE8]] = distinct !DICompositeType(tag: DW_TAG_union_type, name: "w" + +// Check that debug info is not emitted for the typedef, struct, enum, and +// union when -fno-eliminate-unused-debug-types and -g are not set. These are +// the same checks as above with `NODBG-NOT` rather than `CHECK`. + +// NODBG-NOT: !DI{{CompositeType|Enumerator|DerivedType}} + +// Check that debug info is not emitted for declarations. Obnoxious +// indentifiers are to avoid collisions with the SHA emittied as debug info. +struct unused_struct; +enum unused_enum; +union unused_union; +void b0(void) { + struct unused_local_struct; + enum unused_local_enum; + union unused_local_union; +} + +// NODBG-NOT: name: "unused_ diff --git a/clang/test/CodeGen/debug-info-unused-types.cpp b/clang/test/CodeGen/debug-info-unused-types.cpp new file mode 100644 index 00000000000000..ebe1e94624b6ca --- /dev/null +++ b/clang/test/CodeGen/debug-info-unused-types.cpp @@ -0,0 +1,31 @@ +// RUN: %clang++ -fno-eliminate-unused-debug-types -g -emit-llvm -S -o - %s | FileCheck %s +// RUN: %clang++ -fno-eliminate-unused-debug-types -g1 -emit-llvm -S -o - %s | FileCheck --check-prefix=NODBG %s +// RUN: %clang++ -feliminate-unused-debug-types -g -emit-llvm -S -o - %s | FileCheck --check-prefix=NODBG %s +// RUN: %clang++ -g -emit-llvm -S -o - %s | FileCheck --check-prefix=NODBG %s +// RUN: %clang++ -emit-llvm -S -o - %s | FileCheck --check-prefix=NODBG %s +using foo = int; +class bar {}; +enum class baz { BAZ }; + +void quux() { + using x = int; + class y {}; + enum class z { Z }; +} + +// CHECK: !DICompileUnit{{.+}}retainedTypes: [[RETTYPES:![0-9]+]] +// CHECK: [[TYPE0:![0-9]+]] = !DICompositeType(tag: DW_TAG_enumeration_type, name: "baz" +// CHECK: [[TYPE1:![0-9]+]] = !DIEnumerator(name: "BAZ" +// CHECK: [[TYPE2:![0-9]+]] = !DICompositeType(tag: DW_TAG_enumeration_type, name: "z" +// CHECK: [[TYPE3:![0-9]+]] = !DIEnumerator(name: "Z" +// CHECK: [[RETTYPES]] = !{[[TYPE4:![0-9]+]], [[TYPE5:![0-9]+]], [[TYPE0]], !5, [[TYPE6:![0-9]+]], [[TYPE2]]} +// CHECK: [[TYPE4]] = !DIDerivedType(tag: DW_TAG_typedef, name: "foo" +// CHECK: [[TYPE5]] = distinct !DICompositeType(tag: DW_TAG_class_type, name: "bar" +// CHECK: [[TYPE6]] = distinct !DICompositeType(tag: DW_TAG_class_type, name: "y" + +// NODBG-NOT: !DI{{CompositeType|Enumerator|DerivedType}} + +class unused_class; +enum class unused_enum_class; + +// NODBG-NOT: name: "unused_ diff --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c index 189c1f9addeb90..676e2ce2f3bb1a 100644 --- a/clang/test/Driver/debug-options.c +++ b/clang/test/Driver/debug-options.c @@ -361,3 +361,12 @@ // GEMBED_2: error: invalid argument '-gembed-source' only allowed with '-gdwarf-5' // NOGEMBED_5-NOT: "-gembed-source" // NOGEMBED_2-NOT: error: invalid argument '-gembed-source' only allowed with '-gdwarf-5' +// +// RUN: %clang -### -g -fno-eliminate-unused-debug-types -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=DEBUG_UNUSED_TYPES %s +// DEBUG_UNUSED_TYPES: "-debug-info-kind=unused-types" +// DEBUG_UNUSED_TYPES-NOT: "-debug-info-kind=limited" +// RUN: %clang -### -g -feliminate-unused-debug-types -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=NO_DEBUG_UNUSED_TYPES %s +// NO_DEBUG_UNUSED_TYPES: "-debug-info-kind=limited" +// NO_DEBUG_UNUSED_TYPES-NOT: "-debug-info-kind=unused-types" From 38b419eb9330c1f1bcec31764f57e932c07fb42c Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Fri, 7 Aug 2020 14:24:03 -0700 Subject: [PATCH 23/26] Factor out reference-counting code from PlatformApple* into PlatformAppleSimulator. This is legal because that is the only entry point for the Terminate/Initialize functions. --- .../MacOSX/PlatformAppleSimulator.cpp | 64 ++++++++----------- 1 file changed, 28 insertions(+), 36 deletions(-) diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp index 5201e203f77e60..3ca9e6c37fe2a9 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -514,24 +514,19 @@ static llvm::StringRef GetXcodeSDKDir(std::string preferred, return sdk; } -static unsigned g_ios_initialize_count = 0; static const char *g_ios_plugin_name = "ios-simulator"; static const char *g_ios_description = "iPhone simulator platform plug-in."; /// IPhone Simulator Plugin. struct PlatformiOSSimulator { static void Initialize() { - if (g_ios_initialize_count++ == 0) { - PluginManager::RegisterPlugin(ConstString(g_ios_plugin_name), - g_ios_description, - PlatformiOSSimulator::CreateInstance); - } + PluginManager::RegisterPlugin(ConstString(g_ios_plugin_name), + g_ios_description, + PlatformiOSSimulator::CreateInstance); } static void Terminate() { - if (g_ios_initialize_count > 0) - if (--g_ios_initialize_count == 0) - PluginManager::UnregisterPlugin(PlatformiOSSimulator::CreateInstance); + PluginManager::UnregisterPlugin(PlatformiOSSimulator::CreateInstance); } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { @@ -567,24 +562,19 @@ struct PlatformiOSSimulator { } }; -static unsigned g_tvos_initialize_count = 0; static const char *g_tvos_plugin_name = "tvos-simulator"; static const char *g_tvos_description = "tvOS simulator platform plug-in."; /// Apple TV Simulator Plugin. struct PlatformAppleTVSimulator { static void Initialize() { - if (g_tvos_initialize_count++ == 0) { - PluginManager::RegisterPlugin(ConstString(g_tvos_plugin_name), - g_tvos_description, - PlatformAppleTVSimulator::CreateInstance); - } + PluginManager::RegisterPlugin(ConstString(g_tvos_plugin_name), + g_tvos_description, + PlatformAppleTVSimulator::CreateInstance); } static void Terminate() { - if (g_tvos_initialize_count > 0) - if (--g_tvos_initialize_count == 0) - PluginManager::UnregisterPlugin(PlatformAppleTVSimulator::CreateInstance); + PluginManager::UnregisterPlugin(PlatformAppleTVSimulator::CreateInstance); } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { @@ -611,7 +601,6 @@ struct PlatformAppleTVSimulator { }; -static unsigned g_watchos_initialize_count = 0; static const char *g_watchos_plugin_name = "watchos-simulator"; static const char *g_watchos_description = "Apple Watch simulator platform plug-in."; @@ -619,18 +608,14 @@ static const char *g_watchos_description = /// Apple Watch Simulator Plugin. struct PlatformAppleWatchSimulator { static void Initialize() { - if (g_watchos_initialize_count++ == 0) { - PluginManager::RegisterPlugin( - ConstString(g_watchos_plugin_name), g_watchos_description, - PlatformAppleWatchSimulator::CreateInstance); - } + PluginManager::RegisterPlugin(ConstString(g_watchos_plugin_name), + g_watchos_description, + PlatformAppleWatchSimulator::CreateInstance); } static void Terminate() { - if (g_watchos_initialize_count > 0) - if (--g_watchos_initialize_count == 0) - PluginManager::UnregisterPlugin( - PlatformAppleWatchSimulator::CreateInstance); + PluginManager::UnregisterPlugin( + PlatformAppleWatchSimulator::CreateInstance); } static PlatformSP CreateInstance(bool force, const ArchSpec *arch) { @@ -657,18 +642,25 @@ struct PlatformAppleWatchSimulator { }; +static unsigned g_initialize_count = 0; + // Static Functions void PlatformAppleSimulator::Initialize() { - PlatformDarwin::Initialize(); - PlatformiOSSimulator::Initialize(); - PlatformAppleTVSimulator::Initialize(); - PlatformAppleWatchSimulator::Initialize(); + if (g_initialize_count++ == 0) { + PlatformDarwin::Initialize(); + PlatformiOSSimulator::Initialize(); + PlatformAppleTVSimulator::Initialize(); + PlatformAppleWatchSimulator::Initialize(); + } } void PlatformAppleSimulator::Terminate() { - PlatformAppleWatchSimulator::Terminate(); - PlatformAppleTVSimulator::Terminate(); - PlatformiOSSimulator::Terminate(); - PlatformDarwin::Terminate(); + if (g_initialize_count > 0) + if (--g_initialize_count == 0) { + PlatformAppleWatchSimulator::Terminate(); + PlatformAppleTVSimulator::Terminate(); + PlatformiOSSimulator::Terminate(); + PlatformDarwin::Terminate(); + } } From d9a9192984fafb6a81616aafcdcf388fba7b8e14 Mon Sep 17 00:00:00 2001 From: Sameer Arora Date: Mon, 20 Jul 2020 14:27:48 -0700 Subject: [PATCH 24/26] [llvm-libtool-darwin] Add support for -filelist option Add support for `-filelist` option for llvm-libtool-darwin. `-filelist` option allows for passing in a file containing a list of filenames. Reviewed by jhenderson, smeenai Differential Revision: https://reviews.llvm.org/D84206 --- .../docs/CommandGuide/llvm-libtool-darwin.rst | 7 ++ .../tools/llvm-libtool-darwin/filelist.test | 108 ++++++++++++++++++ .../invalid-input-output-args.test | 2 +- .../llvm-libtool-darwin.cpp | 56 ++++++++- 4 files changed, 170 insertions(+), 3 deletions(-) create mode 100644 llvm/test/tools/llvm-libtool-darwin/filelist.test diff --git a/llvm/docs/CommandGuide/llvm-libtool-darwin.rst b/llvm/docs/CommandGuide/llvm-libtool-darwin.rst index 6bae95c3a66983..9ff876eccce239 100644 --- a/llvm/docs/CommandGuide/llvm-libtool-darwin.rst +++ b/llvm/docs/CommandGuide/llvm-libtool-darwin.rst @@ -46,6 +46,13 @@ OPTIONS Produces a static library from the input files. +.. option:: -filelist + + Read input file names from ``. File names are specified in `` + one per line, separated only by newlines. Whitespace on a line is assumed + to be part of the filename. If the directory name, `dirname`, is also + specified then it is prepended to each file name in the ``. + EXIT STATUS ----------- diff --git a/llvm/test/tools/llvm-libtool-darwin/filelist.test b/llvm/test/tools/llvm-libtool-darwin/filelist.test new file mode 100644 index 00000000000000..5e70309cbe487e --- /dev/null +++ b/llvm/test/tools/llvm-libtool-darwin/filelist.test @@ -0,0 +1,108 @@ +## This test checks that the -filelist option works correctly. + +# RUN: yaml2obj %S/Inputs/input1.yaml -o %t-input1.o +# RUN: yaml2obj %S/Inputs/input2.yaml -o %t-input2.o + +## Passing files in a listfile: +# RUN: echo %t-input1.o > %t.files.txt +# RUN: echo %t-input2.o >> %t.files.txt +# RUN: llvm-libtool-darwin -static -o %t.lib -filelist %t.files.txt + +## Check that binaries are present: +# RUN: llvm-ar t %t.lib | \ +# RUN: FileCheck %s --check-prefix=CHECK-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp + +# CHECK-NAMES: [[PREFIX]]-input1.o +# CHECK-NAMES-NEXT: [[PREFIX]]-input2.o + +## Check that symbols are present: +# RUN: llvm-nm --print-armap %t.lib | \ +# RUN: FileCheck %s --check-prefix=CHECK-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines + +# CHECK-SYMBOLS: Archive map +# CHECK-SYMBOLS-NEXT: _symbol1 in [[PREFIX]]-input1.o +# CHECK-SYMBOLS-NEXT: _symbol2 in [[PREFIX]]-input2.o +# CHECK-SYMBOLS-EMPTY: + +# RUN: rm -rf %t/dirname && mkdir -p %t/dirname +# RUN: yaml2obj %S/Inputs/input1.yaml -o %t/dirname/%basename_t.tmp-input1.o +# RUN: echo %basename_t.tmp-input1.o > %t.files.txt + +## Passing in dirname: +# RUN: llvm-libtool-darwin -static -o %t.lib -filelist %t.files.txt,%t/dirname +# RUN: llvm-ar t %t.lib | \ +# RUN: FileCheck %s --check-prefix=DIRNAME-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp +# RUN: llvm-nm --print-armap %t.lib | \ +# RUN: FileCheck %s --check-prefix=DIRNAME-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines + +# DIRNAME-NAMES: [[PREFIX]]-input1.o + +# DIRNAME-SYMBOLS: Archive map +# DIRNAME-SYMBOLS-NEXT: _symbol1 in [[PREFIX]]-input1.o +# DIRNAME-SYMBOLS-EMPTY: + +## Passing both -filelist option and object file as input: +# RUN: llvm-libtool-darwin -static -o %t.lib -filelist %t.files.txt,%t/dirname %t-input2.o +# RUN: llvm-ar t %t.lib | \ +# RUN: FileCheck %s --check-prefix=REVERSE-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp +# RUN: llvm-nm --print-armap %t.lib | \ +# RUN: FileCheck %s --check-prefix=REVERSE-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines + +# REVERSE-NAMES: [[PREFIX]]-input2.o +# REVERSE-NAMES-NEXT: [[PREFIX]]-input1.o + +# REVERSE-SYMBOLS: Archive map +# REVERSE-SYMBOLS-NEXT: _symbol2 in [[PREFIX]]-input2.o +# REVERSE-SYMBOLS-NEXT: _symbol1 in [[PREFIX]]-input1.o +# REVERSE-SYMBOLS-EMPTY: + +## Check that an error is thrown when a file in the filelist doesn't exist in the cwd and no dirname is specified: +# RUN: echo 'no-such-file' > %t.invalid-list.txt +# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.invalid-list.txt 2>&1 | \ +# RUN: FileCheck %s --check-prefix=FILE-ERROR -DFILE=no-such-file + +# FILE-ERROR: error: '[[FILE]]': {{[nN]}}o such file or directory + +## Check that an error is thrown when the directory exists but does not contain the requested file: +# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.invalid-list.txt,%t/dirname 2>&1 | \ +# RUN: FileCheck %s --check-prefix=DIR-ERROR -DDIR=%t/dirname -DFILE=no-such-file + +# DIR-ERROR: error: '[[DIR]]{{[/\\]}}[[FILE]]': {{[nN]}}o such file or directory + +## Check that an error is thrown when a file is in the cwd but dirname is specified: +# RUN: yaml2obj %S/Inputs/input2.yaml -o %basename_t.tmp-input2.o +# RUN: echo %basename_t.tmp-input2.o > %t.files-cwd.txt +# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.files-cwd.txt,%t/dirname 2>&1 | \ +# RUN: FileCheck %s --check-prefix=DIR-ERROR -DDIR=%t/dirname -DFILE=%basename_t.tmp-input2.o + +## Check that an error is thrown when the directory doesn't exist: +# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.files-cwd.txt,%t/Invalid-Dir 2>&1 | \ +# RUN: FileCheck %s --check-prefix=DIR-ERROR -DDIR=%t/Invalid-Dir -DFILE=%basename_t.tmp-input2.o + +## Check that an error is thrown when the filelist is empty: +# RUN: touch %t.empty-list +# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.empty-list 2>&1 | \ +# RUN: FileCheck %s --check-prefix=EMPTY-ERROR -DFILE=%t.empty-list + +# EMPTY-ERROR: error: file list file: '[[FILE]]' is empty + +## Check that an error is thrown when the filelist contains a blank line: +# RUN: echo %t-input2.o > %t.blank-line.txt +# RUN: echo '' >> %t.blank-line.txt +# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.blank-line.txt 2>&1 | \ +# RUN: FileCheck %s --check-prefix=EMPTY-FILENAME -DFILE=%t.blank-line.txt + +# EMPTY-FILENAME: error: file list file: '[[FILE]]': filename cannot be empty + +## Check that an error is thrown when the filelist contains a line with only spaces: +# RUN: echo %t-input2.o > %t.space-line.txt +# RUN: echo " " >> %t.space-line.txt +# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.space-line.txt 2>&1 | \ +# RUN: FileCheck %s --check-prefix=FILE-ERROR -DFILE=' ' --strict-whitespace + +## Filelist option specified more than once: +# RUN: touch %t.list1.txt and %t.list2.txt +# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.list1.txt -filelist %t.list2.txt 2>&1 | \ +# RUN: FileCheck %s --check-prefix=DUPLICATE-ERROR + +# DUPLICATE-ERROR: for the --filelist option: may only occur zero or one times! diff --git a/llvm/test/tools/llvm-libtool-darwin/invalid-input-output-args.test b/llvm/test/tools/llvm-libtool-darwin/invalid-input-output-args.test index 66ee65b2624421..31ff43f62400b3 100644 --- a/llvm/test/tools/llvm-libtool-darwin/invalid-input-output-args.test +++ b/llvm/test/tools/llvm-libtool-darwin/invalid-input-output-args.test @@ -4,7 +4,7 @@ # RUN: not llvm-libtool-darwin -static -o %t.lib 2>&1 | \ # RUN: FileCheck %s --check-prefix=NO-INPUT -# NO-INPUT: Must specify at least 1 positional argument +# NO-INPUT: error: no input files specified ## Missing output file: # RUN: not llvm-libtool-darwin -static %t.input 2>&1 | \ diff --git a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp index bd1d9ac07c6995..d5eccafbe46f06 100644 --- a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp +++ b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp @@ -16,6 +16,7 @@ #include "llvm/Object/ObjectFile.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/InitLLVM.h" +#include "llvm/Support/LineIterator.h" #include "llvm/Support/WithColor.h" using namespace llvm; @@ -29,7 +30,7 @@ static cl::opt OutputFile("o", cl::desc("Specify output filename"), static cl::list InputFiles(cl::Positional, cl::desc(""), - cl::OneOrMore, + cl::ZeroOrMore, cl::cat(LibtoolCategory)); enum class Operation { Static }; @@ -41,6 +42,44 @@ static cl::opt LibraryOperation( "Produce a statically linked library from the input files")), cl::Required, cl::cat(LibtoolCategory)); +static cl::opt + FileList("filelist", + cl::desc("Pass in file containing a list of filenames"), + cl::value_desc("listfile[,dirname]"), cl::cat(LibtoolCategory)); + +static Error processFileList() { + StringRef FileName, DirName; + std::tie(FileName, DirName) = StringRef(FileList).rsplit(","); + + ErrorOr> FileOrErr = + MemoryBuffer::getFileOrSTDIN(FileName, /*FileSize=*/-1, + /*RequiresNullTerminator=*/false); + if (std::error_code EC = FileOrErr.getError()) + return createFileError(FileName, errorCodeToError(EC)); + const MemoryBuffer &Ref = *FileOrErr.get(); + + line_iterator I(Ref, /*SkipBlanks=*/false); + if (I.is_at_eof()) + return createStringError(std::errc::invalid_argument, + "file list file: '%s' is empty", + FileName.str().c_str()); + for (; !I.is_at_eof(); ++I) { + StringRef Line = *I; + if (Line.empty()) + return createStringError(std::errc::invalid_argument, + "file list file: '%s': filename cannot be empty", + FileName.str().c_str()); + + SmallString<128> Path; + if (!DirName.empty()) + sys::path::append(Path, DirName, Line); + else + sys::path::append(Path, Line); + InputFiles.push_back(static_cast(Path)); + } + return Error::success(); +} + static Error verifyMachOObject(const NewArchiveMember &Member) { auto MBRef = Member.Buf->getMemBufferRef(); Expected> ObjOrErr = @@ -135,12 +174,25 @@ int main(int Argc, char **Argv) { InitLLVM X(Argc, Argv); cl::HideUnrelatedOptions({&LibtoolCategory, &ColorCategory}); cl::ParseCommandLineOptions(Argc, Argv, "llvm-libtool-darwin\n"); + if (!FileList.empty()) { + if (Error E = processFileList()) { + WithColor::defaultErrorHandler(std::move(E)); + return EXIT_FAILURE; + } + } + + if (InputFiles.empty()) { + Error E = createStringError(std::errc::invalid_argument, + "no input files specified"); + WithColor::defaultErrorHandler(std::move(E)); + return EXIT_FAILURE; + } switch (LibraryOperation) { case Operation::Static: if (Error E = createStaticLibrary()) { WithColor::defaultErrorHandler(std::move(E)); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } break; } From 71a1f135e4ede2b03f5efb7e18dca1c3db7504ec Mon Sep 17 00:00:00 2001 From: Sameer Arora Date: Mon, 20 Jul 2020 16:10:07 -0700 Subject: [PATCH 25/26] [llvm-libtool-darwin] Add support for -D and -U options Add support for `-D` and `-U` options for llvm-libtool-darwin. `-D` allows for using zero for timestamps and UIDs/GIDs. `-U` allows for using actual timestamps and UIDs/GIDs. Reviewed by jhenderson, smeenai Differential Revision: https://reviews.llvm.org/D84209 --- .../docs/CommandGuide/llvm-libtool-darwin.rst | 8 ++ .../deterministic-library.test | 42 ++++++++++ .../llvm-libtool-darwin.cpp | 76 +++++++++++++------ 3 files changed, 101 insertions(+), 25 deletions(-) create mode 100644 llvm/test/tools/llvm-libtool-darwin/deterministic-library.test diff --git a/llvm/docs/CommandGuide/llvm-libtool-darwin.rst b/llvm/docs/CommandGuide/llvm-libtool-darwin.rst index 9ff876eccce239..2944aa6ee37f0c 100644 --- a/llvm/docs/CommandGuide/llvm-libtool-darwin.rst +++ b/llvm/docs/CommandGuide/llvm-libtool-darwin.rst @@ -38,6 +38,14 @@ OPTIONS Display the version of this program. +.. option:: -D + + Use zero for timestamps and UIDs/GIDs. This is set by default. + +.. option:: -U + + Use actual timestamps and UIDs/GIDs. + .. option:: -o Specify the output file name. Must be specified exactly once. diff --git a/llvm/test/tools/llvm-libtool-darwin/deterministic-library.test b/llvm/test/tools/llvm-libtool-darwin/deterministic-library.test new file mode 100644 index 00000000000000..5408309f6e9585 --- /dev/null +++ b/llvm/test/tools/llvm-libtool-darwin/deterministic-library.test @@ -0,0 +1,42 @@ +## This test checks that timestamps are set to 0 by default or when the -D +## option is specified, and that they are preserved when the -U option is +## specified. +## We only test timestamps as a proxy for full deterministic writing; i.e. we +## assume UID/GIDs are preserved if timestamps are preserved. + +# RUN: yaml2obj %S/Inputs/input1.yaml -o %t-input1.o +# RUN: touch -t 199505050555.55 %t-input1.o + +## Test values are set to 0 (by default): +# RUN: llvm-libtool-darwin -static -o %t.lib %t-input1.o +# RUN: env TZ=GMT llvm-ar tv %t.lib | FileCheck %s --check-prefix=CHECK-DETERMINISTIC + +## Test values are set to 0 (with -D): +# RUN: llvm-libtool-darwin -static -o %t.lib -D %t-input1.o +# RUN: env TZ=GMT llvm-ar tv %t.lib | FileCheck %s --check-prefix=CHECK-DETERMINISTIC + +# CHECK-DETERMINISTIC: {{[[:space:]]1970[[:space:]]}} + +## Test values are preserved (with -U): +# RUN: llvm-libtool-darwin -static -o %t.lib -U %t-input1.o +# RUN: env TZ=GMT llvm-ar tv %t.lib | FileCheck %s --check-prefix=CHECK-NONDETERMINISTIC + +# CHECK-NONDETERMINISTIC: {{[[:space:]]1995[[:space:]]}} + +## D Flag specified more than once: +# RUN: not llvm-libtool-darwin -static -o %t.lib %t-input1.o -D -D 2>&1 | \ +# RUN: FileCheck %s --check-prefix=CHECK-ERROR-D + +# CHECK-ERROR-D: for the -D option: may only occur zero or one times! + +## U Flag specified more than once: +# RUN: not llvm-libtool-darwin -static -o %t.lib %t-input1.o -U -U 2>&1 | \ +# RUN: FileCheck %s --check-prefix=CHECK-ERROR-U + +# CHECK-ERROR-U: for the -U option: may only occur zero or one times! + +## Both D and U flags specified: +# RUN: not llvm-libtool-darwin -static -o %t.lib %t-input1.o -D -U 2>&1 | \ +# RUN: FileCheck %s --check-prefix=CHECK-ERROR-BOTH + +# CHECK-ERROR-BOTH: error: cannot specify both -D and -U flags diff --git a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp index d5eccafbe46f06..871a8036dab07b 100644 --- a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp +++ b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp @@ -42,11 +42,23 @@ static cl::opt LibraryOperation( "Produce a statically linked library from the input files")), cl::Required, cl::cat(LibtoolCategory)); +static cl::opt DeterministicOption( + "D", cl::desc("Use zero for timestamps and UIDs/GIDs (Default)"), + cl::init(false), cl::cat(LibtoolCategory)); + +static cl::opt + NonDeterministicOption("U", cl::desc("Use actual timestamps and UIDs/GIDs"), + cl::init(false), cl::cat(LibtoolCategory)); + static cl::opt FileList("filelist", cl::desc("Pass in file containing a list of filenames"), cl::value_desc("listfile[,dirname]"), cl::cat(LibtoolCategory)); +struct Config { + bool Deterministic = true; // Updated by 'D' and 'U' modifiers. +}; + static Error processFileList() { StringRef FileName, DirName; std::tie(FileName, DirName) = StringRef(FileList).rsplit(","); @@ -99,9 +111,9 @@ static Error verifyMachOObject(const NewArchiveMember &Member) { } static Error addChildMember(std::vector &Members, - const object::Archive::Child &M) { + const object::Archive::Child &M, const Config &C) { Expected NMOrErr = - NewArchiveMember::getOldMember(M, /*Deterministic=*/true); + NewArchiveMember::getOldMember(M, C.Deterministic); if (!NMOrErr) return NMOrErr.takeError(); @@ -115,9 +127,10 @@ static Error addChildMember(std::vector &Members, static Error addMember(std::vector &Members, StringRef FileName, - std::vector> &ArchiveBuffers) { + std::vector> &ArchiveBuffers, + const Config &C) { Expected NMOrErr = - NewArchiveMember::getFile(FileName, /*Deterministic=*/true); + NewArchiveMember::getFile(FileName, C.Deterministic); if (!NMOrErr) return createFileError(FileName, NMOrErr.takeError()); @@ -135,7 +148,7 @@ addMember(std::vector &Members, StringRef FileName, Error Err = Error::success(); for (const object::Archive::Child &Child : Lib.children(Err)) - if (Error E = addChildMember(Members, Child)) + if (Error E = addChildMember(Members, Child, C)) return createFileError(FileName, std::move(E)); if (Err) return createFileError(FileName, std::move(Err)); @@ -154,43 +167,56 @@ addMember(std::vector &Members, StringRef FileName, return Error::success(); } -static Error createStaticLibrary() { +static Error createStaticLibrary(const Config &C) { std::vector NewMembers; std::vector> ArchiveBuffers; for (StringRef Member : InputFiles) - if (Error E = addMember(NewMembers, Member, ArchiveBuffers)) + if (Error E = addMember(NewMembers, Member, ArchiveBuffers, C)) return E; - if (Error E = writeArchive(OutputFile, NewMembers, - /*WriteSymtab=*/true, - /*Kind=*/object::Archive::K_DARWIN, - /*Deterministic=*/true, - /*Thin=*/false)) + if (Error E = + writeArchive(OutputFile, NewMembers, + /*WriteSymtab=*/true, + /*Kind=*/object::Archive::K_DARWIN, C.Deterministic, + /*Thin=*/false)) return E; return Error::success(); } +static Expected parseCommandLine(int Argc, char **Argv) { + Config C; + cl::ParseCommandLineOptions(Argc, Argv, "llvm-libtool-darwin\n"); + + if (DeterministicOption && NonDeterministicOption) + return createStringError(std::errc::invalid_argument, + "cannot specify both -D and -U flags"); + else if (NonDeterministicOption) + C.Deterministic = false; + + if (!FileList.empty()) + if (Error E = processFileList()) + return std::move(E); + + if (InputFiles.empty()) + return createStringError(std::errc::invalid_argument, + "no input files specified"); + + return C; +} + int main(int Argc, char **Argv) { InitLLVM X(Argc, Argv); cl::HideUnrelatedOptions({&LibtoolCategory, &ColorCategory}); - cl::ParseCommandLineOptions(Argc, Argv, "llvm-libtool-darwin\n"); - if (!FileList.empty()) { - if (Error E = processFileList()) { - WithColor::defaultErrorHandler(std::move(E)); - return EXIT_FAILURE; - } - } - - if (InputFiles.empty()) { - Error E = createStringError(std::errc::invalid_argument, - "no input files specified"); - WithColor::defaultErrorHandler(std::move(E)); + Expected ConfigOrErr = parseCommandLine(Argc, Argv); + if (!ConfigOrErr) { + WithColor::defaultErrorHandler(ConfigOrErr.takeError()); return EXIT_FAILURE; } + Config C = *ConfigOrErr; switch (LibraryOperation) { case Operation::Static: - if (Error E = createStaticLibrary()) { + if (Error E = createStaticLibrary(C)) { WithColor::defaultErrorHandler(std::move(E)); return EXIT_FAILURE; } From d3dfd8cec44072302818c34193d898903dbaef8f Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Fri, 7 Aug 2020 14:44:01 -0700 Subject: [PATCH 26/26] Add a setting to force stepping to always run all threads. Also allow ScriptedThreadPlans to set & get their StopOthers state. Differential Revision: https://reviews.llvm.org/D85265 --- lldb/bindings/interface/SBThreadPlan.i | 8 +++ lldb/include/lldb/API/SBThreadPlan.h | 4 ++ lldb/include/lldb/Target/Process.h | 1 + lldb/include/lldb/Target/ThreadPlanPython.h | 5 +- lldb/source/API/SBThreadPlan.cpp | 19 +++++++ lldb/source/Commands/CommandObjectThread.cpp | 13 ++++- lldb/source/Target/Process.cpp | 6 ++ lldb/source/Target/TargetProperties.td | 3 + lldb/source/Target/Thread.cpp | 2 +- lldb/source/Target/ThreadPlanPython.cpp | 12 +--- .../functionalities/step_scripted/Steps.py | 22 ++++++- .../step_scripted/TestStepScripted.py | 57 ++++++++++++++++++- 12 files changed, 136 insertions(+), 16 deletions(-) diff --git a/lldb/bindings/interface/SBThreadPlan.i b/lldb/bindings/interface/SBThreadPlan.i index 36131d529b7b7c..2003c6fdee3a3a 100644 --- a/lldb/bindings/interface/SBThreadPlan.i +++ b/lldb/bindings/interface/SBThreadPlan.i @@ -92,6 +92,14 @@ public: bool IsPlanStale(); + %feature("docstring", "Return whether this plan will ask to stop other threads when it runs.") GetStopOthers; + bool + GetStopOthers(); + + %feature("docstring", "Set whether this plan will ask to stop other threads when it runs.") GetStopOthers; + void + SetStopOthers(bool stop_others); + SBThreadPlan QueueThreadPlanForStepOverRange (SBAddress &start_address, lldb::addr_t range_size); diff --git a/lldb/include/lldb/API/SBThreadPlan.h b/lldb/include/lldb/API/SBThreadPlan.h index 6639c10e437b34..0dc48437a6681b 100644 --- a/lldb/include/lldb/API/SBThreadPlan.h +++ b/lldb/include/lldb/API/SBThreadPlan.h @@ -77,6 +77,10 @@ class LLDB_API SBThreadPlan { bool IsValid(); + bool GetStopOthers(); + + void SetStopOthers(bool stop_others); + // This section allows an SBThreadPlan to push another of the common types of // plans... SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address, diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index bf9b64547ed501..2abedb8f6e2eff 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -91,6 +91,7 @@ class ProcessProperties : public Properties { std::chrono::seconds GetUtilityExpressionTimeout() const; bool GetOSPluginReportsAllThreads() const; void SetOSPluginReportsAllThreads(bool does_report); + bool GetSteppingRunsAllThreads() const; protected: Process *m_process; // Can be nullptr for global ProcessProperties diff --git a/lldb/include/lldb/Target/ThreadPlanPython.h b/lldb/include/lldb/Target/ThreadPlanPython.h index 27bf3a560b1ff5..c04500ad5de858 100644 --- a/lldb/include/lldb/Target/ThreadPlanPython.h +++ b/lldb/include/lldb/Target/ThreadPlanPython.h @@ -45,7 +45,9 @@ class ThreadPlanPython : public ThreadPlan { bool WillStop() override; - bool StopOthers() override; + bool StopOthers() override { return m_stop_others; } + + void SetStopOthers(bool new_value) { m_stop_others = new_value; } void DidPush() override; @@ -67,6 +69,7 @@ class ThreadPlanPython : public ThreadPlan { std::string m_error_str; StructuredData::ObjectSP m_implementation_sp; bool m_did_push; + bool m_stop_others; ThreadPlanPython(const ThreadPlanPython &) = delete; const ThreadPlanPython &operator=(const ThreadPlanPython &) = delete; diff --git a/lldb/source/API/SBThreadPlan.cpp b/lldb/source/API/SBThreadPlan.cpp index c740c8b7492fc9..9af673b0f3a993 100644 --- a/lldb/source/API/SBThreadPlan.cpp +++ b/lldb/source/API/SBThreadPlan.cpp @@ -196,6 +196,23 @@ bool SBThreadPlan::IsValid() { return false; } +bool SBThreadPlan::GetStopOthers() { + LLDB_RECORD_METHOD_NO_ARGS(bool, SBThreadPlan, GetStopOthers); + + ThreadPlanSP thread_plan_sp(GetSP()); + if (thread_plan_sp) + return thread_plan_sp->StopOthers(); + return false; +} + +void SBThreadPlan::SetStopOthers(bool stop_others) { + LLDB_RECORD_METHOD(void, SBThreadPlan, SetStopOthers, (bool), stop_others); + + ThreadPlanSP thread_plan_sp(GetSP()); + if (thread_plan_sp) + thread_plan_sp->SetStopOthers(stop_others); +} + // This section allows an SBThreadPlan to push another of the common types of // plans... // @@ -463,6 +480,8 @@ void RegisterMethods(Registry &R) { LLDB_REGISTER_METHOD(bool, SBThreadPlan, IsPlanComplete, ()); LLDB_REGISTER_METHOD(bool, SBThreadPlan, IsPlanStale, ()); LLDB_REGISTER_METHOD(bool, SBThreadPlan, IsValid, ()); + LLDB_REGISTER_METHOD(void, SBThreadPlan, SetStopOthers, (bool)); + LLDB_REGISTER_METHOD(bool, SBThreadPlan, GetStopOthers, ()); LLDB_REGISTER_METHOD(lldb::SBThreadPlan, SBThreadPlan, QueueThreadPlanForStepOverRange, (lldb::SBAddress &, lldb::addr_t)); diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index f0ad1798fec6ac..666c208c32067c 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -482,8 +482,16 @@ class ThreadStepScopeOptionGroup : public OptionGroup { // Check if we are in Non-Stop mode TargetSP target_sp = execution_context ? execution_context->GetTargetSP() : TargetSP(); - if (target_sp && target_sp->GetNonStopModeEnabled()) + if (target_sp && target_sp->GetNonStopModeEnabled()) { + // NonStopMode runs all threads by definition, so when it is on we don't + // need to check the process setting for runs all threads. m_run_mode = eOnlyThisThread; + } else { + ProcessSP process_sp = + execution_context ? execution_context->GetProcessSP() : ProcessSP(); + if (process_sp && process_sp->GetSteppingRunsAllThreads()) + m_run_mode = eAllThreads; + } m_avoid_regexp.clear(); m_step_in_target.clear(); @@ -612,8 +620,7 @@ class CommandObjectThreadStepWithTypeAndScope : public CommandObjectParsed { if (m_options.m_run_mode == eAllThreads) bool_stop_other_threads = false; else if (m_options.m_run_mode == eOnlyDuringStepping) - bool_stop_other_threads = - (m_step_type != eStepTypeOut && m_step_type != eStepTypeScripted); + bool_stop_other_threads = (m_step_type != eStepTypeOut); else bool_stop_other_threads = true; diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index e88911ad7210f0..c602511daedc39 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -278,6 +278,12 @@ std::chrono::seconds ProcessProperties::GetUtilityExpressionTimeout() const { return std::chrono::seconds(value); } +bool ProcessProperties::GetSteppingRunsAllThreads() const { + const uint32_t idx = ePropertySteppingRunsAllThreads; + return m_collection_sp->GetPropertyAtIndexAsBoolean( + nullptr, idx, g_process_properties[idx].default_uint_value != 0); +} + bool ProcessProperties::GetOSPluginReportsAllThreads() const { const bool fail_value = true; const Property *exp_property = diff --git a/lldb/source/Target/TargetProperties.td b/lldb/source/Target/TargetProperties.td index 58aae058d5d43a..7fb9b105ceefbe 100644 --- a/lldb/source/Target/TargetProperties.td +++ b/lldb/source/Target/TargetProperties.td @@ -217,6 +217,9 @@ let Definition = "process" in { def UtilityExpressionTimeout: Property<"utility-expression-timeout", "UInt64">, DefaultUnsignedValue<15>, Desc<"The time in seconds to wait for LLDB-internal utility expressions.">; + def SteppingRunsAllThreads: Property<"run-all-threads", "Boolean">, + DefaultFalse, + Desc<"If true, stepping operations will run all threads. This is equivalent to setting the run-mode option to 'all-threads'.">; } let Definition = "platform" in { diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index ad28603cc02ec8..fdf60f96f983b2 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -1380,7 +1380,7 @@ lldb::ThreadPlanSP Thread::QueueThreadPlanForStepScripted( ThreadPlanSP thread_plan_sp(new ThreadPlanPython(*this, class_name, extra_args_impl)); - + thread_plan_sp->SetStopOthers(stop_other_threads); status = QueueThreadPlan(thread_plan_sp, abort_other_plans); return thread_plan_sp; } diff --git a/lldb/source/Target/ThreadPlanPython.cpp b/lldb/source/Target/ThreadPlanPython.cpp index 8171186319f5cb..e83f0e9e715e49 100644 --- a/lldb/source/Target/ThreadPlanPython.cpp +++ b/lldb/source/Target/ThreadPlanPython.cpp @@ -25,11 +25,12 @@ using namespace lldb_private; // ThreadPlanPython -ThreadPlanPython::ThreadPlanPython(Thread &thread, const char *class_name, +ThreadPlanPython::ThreadPlanPython(Thread &thread, const char *class_name, StructuredDataImpl *args_data) : ThreadPlan(ThreadPlan::eKindPython, "Python based Thread Plan", thread, eVoteNoOpinion, eVoteNoOpinion), - m_class_name(class_name), m_args_data(args_data), m_did_push(false) { + m_class_name(class_name), m_args_data(args_data), m_did_push(false), + m_stop_others(false) { SetIsMasterPlan(true); SetOkayToDiscard(true); SetPrivate(false); @@ -162,13 +163,6 @@ lldb::StateType ThreadPlanPython::GetPlanRunState() { } // The ones below are not currently exported to Python. - -bool ThreadPlanPython::StopOthers() { - // For now Python plans run all threads, but we should add some controls for - // this. - return false; -} - void ThreadPlanPython::GetDescription(Stream *s, lldb::DescriptionLevel level) { s->Printf("Python thread plan implemented by class %s.", m_class_name.c_str()); diff --git a/lldb/test/API/functionalities/step_scripted/Steps.py b/lldb/test/API/functionalities/step_scripted/Steps.py index 4133cbbe6086af..d41d01d43095e7 100644 --- a/lldb/test/API/functionalities/step_scripted/Steps.py +++ b/lldb/test/API/functionalities/step_scripted/Steps.py @@ -75,9 +75,29 @@ def should_stop(self, event): if not self.value.IsValid(): return True - print("Got next value: %d"%(self.value.GetValueAsUnsigned())) if not self.value.GetValueDidChange(): self.child_thread_plan = self.queue_child_thread_plan() return False else: return True + +# This plan does nothing, but sets stop_mode to the +# value of GetStopOthers for this plan. +class StepReportsStopOthers(): + stop_mode_dict = {} + + def __init__(self, thread_plan, args_data, dict): + self.thread_plan = thread_plan + self.key = args_data.GetValueForKey("token").GetStringValue(1000) + + def should_stop(self, event): + self.thread_plan.SetPlanComplete(True) + print("Called in should_stop") + StepReportsStopOthers.stop_mode_dict[self.key] = self.thread_plan.GetStopOthers() + return True + + def should_step(self): + return True + + def explains_stop(self, event): + return True diff --git a/lldb/test/API/functionalities/step_scripted/TestStepScripted.py b/lldb/test/API/functionalities/step_scripted/TestStepScripted.py index 1e87541960c809..60eb961737653f 100644 --- a/lldb/test/API/functionalities/step_scripted/TestStepScripted.py +++ b/lldb/test/API/functionalities/step_scripted/TestStepScripted.py @@ -1,7 +1,7 @@ """ Tests stepping with scripted thread plans. """ - +import threading import lldb import lldbsuite.test.lldbutil as lldbutil from lldbsuite.test.decorators import * @@ -111,3 +111,58 @@ def do_test_checking_variable(self, use_cli): # And foo should have changed: self.assertTrue(foo_val.GetValueDidChange(), "Foo changed") + + def test_stop_others_from_command(self): + """Test that the stop-others flag is set correctly by the command line. + Also test that the run-all-threads property overrides this.""" + self.do_test_stop_others() + + def run_step(self, stop_others_value, run_mode, token): + import Steps + interp = self.dbg.GetCommandInterpreter() + result = lldb.SBCommandReturnObject() + + cmd = "thread step-scripted -C Steps.StepReportsStopOthers -k token -v %s"%(token) + if run_mode != None: + cmd = cmd + " --run-mode %s"%(run_mode) + print(cmd) + interp.HandleCommand(cmd, result) + self.assertTrue(result.Succeeded(), "Step scripted failed: %s."%(result.GetError())) + print(Steps.StepReportsStopOthers.stop_mode_dict) + value = Steps.StepReportsStopOthers.stop_mode_dict[token] + self.assertEqual(value, stop_others_value, "Stop others has the correct value.") + + def do_test_stop_others(self): + self.build() + (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + "Set a breakpoint here", + self.main_source_file) + # First run with stop others false and see that we got that. + thread_id = "" + if sys.version_info.major == 2: + thread_id = str(threading._get_ident()) + else: + thread_id = str(threading.get_ident()) + + # all-threads should set stop others to False. + self.run_step(False, "all-threads", thread_id) + + # this-thread should set stop others to True + self.run_step(True, "this-thread", thread_id) + + # The default value should be stop others: + self.run_step(True, None, thread_id) + + # The target.process.run-all-threads should override this: + interp = self.dbg.GetCommandInterpreter() + result = lldb.SBCommandReturnObject() + + interp.HandleCommand("settings set target.process.run-all-threads true", result) + self.assertTrue(result.Succeeded, "setting run-all-threads works.") + + self.run_step(False, None, thread_id) + + + + +