[llvm-branch-commits] [libcxx] 7af201c - [libcxx] [doc] Remove a leftover tentative release note
Author: Martin Storsjö Date: 2022-08-15T14:27:47+03:00 New Revision: 7af201cba581930f990f70cb99bb91e7a046b307 URL: https://github.com/llvm/llvm-project/commit/7af201cba581930f990f70cb99bb91e7a046b307 DIFF: https://github.com/llvm/llvm-project/commit/7af201cba581930f990f70cb99bb91e7a046b307.diff LOG: [libcxx] [doc] Remove a leftover tentative release note This release note was added tentatively in https://reviews.llvm.org/D120982 / ebde6fc23bc0ee9d022fcd26b52bc82dfb7c8468. The issue was resolved differently in https://reviews.llvm.org/D125715 / bedf657d0f4c54ffe9ef4303382657a74296b544, but that commit forgot to remove the tentative release note. Added: Modified: libcxx/docs/ReleaseNotes.rst Removed: diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst index 6acde0db864bf..9fd114a05585d 100644 --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -239,11 +239,6 @@ Build System Changes use the ``CMAKE_CXX_COMPILER_TARGET``, ``CMAKE_SYSROOT`` and ``CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN`` variables provided by CMake. -- When building for Windows, vendors who want to avoid dll-exporting symbols from the static libc++abi - library should set ``LIBCXXABI_HERMETIC_STATIC_LIBRARY=ON`` when configuring CMake. The current - behavior, which tries to guess the correct dll-export semantics based on whether we're building - the libc++ shared library, will be removed in LLVM 16. - - Previously, the C++ ABI library headers would be installed inside ``/include/c++/v1`` alongside the libc++ headers as part of building libc++. This is not the case anymore -- the ABI library is expected to install its headers where it wants them as part of its own build. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 5b93812 - __has_trivial_copy should map to __is_trivially_copyable
Author: Zachary Henkel Date: 2022-08-15T09:40:11+02:00 New Revision: 5b93812e72dde46079e73deef8bd596e7f907fac URL: https://github.com/llvm/llvm-project/commit/5b93812e72dde46079e73deef8bd596e7f907fac DIFF: https://github.com/llvm/llvm-project/commit/5b93812e72dde46079e73deef8bd596e7f907fac.diff LOG: __has_trivial_copy should map to __is_trivially_copyable Found during clang 15 RC1 testing due to the new diagnostic added by @royjacobson since clang 14. Uncertain if this fix meets the bar to also be applied to the release branch. If accepted, I'll need someone with commit access to submit on my behalf. Reviewed By: royjacobson, aaron.ballman, erichkeane Differential Revision: https://reviews.llvm.org/D131730 (cherry picked from commit 64f0f7e6460019a38fe2f1cbe4b9446a3268af18) Added: Modified: clang/docs/LanguageExtensions.rst clang/lib/Sema/SemaExprCXX.cpp clang/test/SemaCXX/deprecated-builtins.cpp Removed: diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index 6b8b88020ed0..de305ce79c24 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -1375,7 +1375,7 @@ The following type trait primitives are supported by Clang. Those traits marked * ``__has_trivial_move_assign`` (GNU, Microsoft): Deprecated, use ``__is_trivially_assignable`` instead. * ``__has_trivial_copy`` (GNU, Microsoft): - Deprecated, use ``__is_trivially_constructible`` instead. + Deprecated, use ``__is_trivially_copyable`` instead. * ``__has_trivial_constructor`` (GNU, Microsoft): Deprecated, use ``__is_trivially_constructible`` instead. * ``__has_trivial_move_constructor`` (GNU, Microsoft): diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 5331193de863..6f9e025283f5 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -5412,6 +5412,8 @@ void DiagnoseBuiltinDeprecation(Sema& S, TypeTrait Kind, Replacement = BTT_IsTriviallyAssignable; break; case UTT_HasTrivialCopy: + Replacement = UTT_IsTriviallyCopyable; + break; case UTT_HasTrivialDefaultConstructor: case UTT_HasTrivialMoveConstructor: Replacement = TT_IsTriviallyConstructible; diff --git a/clang/test/SemaCXX/deprecated-builtins.cpp b/clang/test/SemaCXX/deprecated-builtins.cpp index 2bb687c1ef12..849b9b014fff 100644 --- a/clang/test/SemaCXX/deprecated-builtins.cpp +++ b/clang/test/SemaCXX/deprecated-builtins.cpp @@ -11,7 +11,7 @@ void f() { a = __has_nothrow_constructor(A); // expected-warning-re {{__has_nothrow_constructor {{.*}} use __is_nothrow_constructible}} a = __has_trivial_assign(A); // expected-warning-re {{__has_trivial_assign {{.*}} use __is_trivially_assignable}} a = __has_trivial_move_assign(A); // expected-warning-re {{__has_trivial_move_assign {{.*}} use __is_trivially_assignable}} -a = __has_trivial_copy(A); // expected-warning-re {{__has_trivial_copy {{.*}} use __is_trivially_constructible}} +a = __has_trivial_copy(A); // expected-warning-re {{__has_trivial_copy {{.*}} use __is_trivially_copyable}} a = __has_trivial_constructor(A); // expected-warning-re {{__has_trivial_constructor {{.*}} use __is_trivially_constructible}} a = __has_trivial_move_constructor(A); // expected-warning-re {{__has_trivial_move_constructor {{.*}} use __is_trivially_constructible}} a = __has_trivial_destructor(A); // expected-warning-re {{__has_trivial_destructor {{.*}} use __is_trivially_destructible}} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] accc7a1 - [X86][FP16] Promote FP16->[U]INT to FP16->FP32->[U]INT
Author: Phoebe Wang Date: 2022-08-15T09:39:57+02:00 New Revision: accc7a13b5edb07eae3415ea69154f4daa247afb URL: https://github.com/llvm/llvm-project/commit/accc7a13b5edb07eae3415ea69154f4daa247afb DIFF: https://github.com/llvm/llvm-project/commit/accc7a13b5edb07eae3415ea69154f4daa247afb.diff LOG: [X86][FP16] Promote FP16->[U]INT to FP16->FP32->[U]INT This is to avoid f16->i64 being lowered to `__fixhfdi/__fixunshfdi` on 32-bits since neither libgcc nor compiler-rt provide them. https://godbolt.org/z/cjWEsea5v It also helps to improve the performance by promoting the vector type. Reviewed By: LuoYuanke Differential Revision: https://reviews.llvm.org/D131828 (cherry picked from commit 8b69549dc5c5fa0f5f8632cde1c740bb2c7d8957) Added: Modified: llvm/lib/Target/X86/X86ISelLowering.cpp llvm/test/CodeGen/X86/fpclamptosat_vec.ll llvm/test/CodeGen/X86/half.ll llvm/test/CodeGen/X86/vector-half-conversions.ll Removed: diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 1ccabf05fe12..372371252b4f 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -32705,8 +32705,29 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N, N->getOpcode() == ISD::STRICT_FP_TO_SINT; EVT VT = N->getValueType(0); SDValue Src = N->getOperand(IsStrict ? 1 : 0); +SDValue Chain = IsStrict ? N->getOperand(0) : SDValue(); EVT SrcVT = Src.getValueType(); +SDValue Res; +if (isSoftFP16(SrcVT)) { + EVT NVT = VT.isVector() ? VT.changeVectorElementType(MVT::f32) : MVT::f32; + if (IsStrict) { +Res = +DAG.getNode(N->getOpcode(), dl, {VT, MVT::Other}, +{Chain, DAG.getNode(ISD::STRICT_FP_EXTEND, dl, +{NVT, MVT::Other}, {Chain, Src})}); +Chain = Res.getValue(1); + } else { +Res = DAG.getNode(N->getOpcode(), dl, VT, + DAG.getNode(ISD::FP_EXTEND, dl, NVT, Src)); + } + Results.push_back(Res); + if (IsStrict) +Results.push_back(Chain); + + return; +} + if (VT.isVector() && Subtarget.hasFP16() && SrcVT.getVectorElementType() == MVT::f16) { EVT EleVT = VT.getVectorElementType(); @@ -32720,7 +32741,6 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N, Src = DAG.getNode(ISD::CONCAT_VECTORS, dl, MVT::v8f16, Ops); } - SDValue Res, Chain; if (IsStrict) { unsigned Opc = IsSigned ? X86ISD::STRICT_CVTTP2SI : X86ISD::STRICT_CVTTP2UI; @@ -32912,7 +32932,6 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N, return; } -SDValue Chain; if (SDValue V = FP_TO_INTHelper(SDValue(N, 0), DAG, IsSigned, Chain)) { Results.push_back(V); if (IsStrict) diff --git a/llvm/test/CodeGen/X86/fpclamptosat_vec.ll b/llvm/test/CodeGen/X86/fpclamptosat_vec.ll index c22656dc2a16..c6883afe07ed 100644 --- a/llvm/test/CodeGen/X86/fpclamptosat_vec.ll +++ b/llvm/test/CodeGen/X86/fpclamptosat_vec.ll @@ -863,59 +863,47 @@ define <8 x i16> @stest_f16i16(<8 x half> %x) { ; CHECK-NEXT:movdqa %xmm0, (%rsp) # 16-byte Spill ; CHECK-NEXT:psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero ; CHECK-NEXT:callq __extendhfsf2@PLT -; CHECK-NEXT:cvttss2si %xmm0, %eax -; CHECK-NEXT:movd %eax, %xmm0 ; CHECK-NEXT:movdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill ; CHECK-NEXT:movaps (%rsp), %xmm0 # 16-byte Reload ; CHECK-NEXT:shufps {{.*#+}} xmm0 = xmm0[3,3,3,3] ; CHECK-NEXT:callq __extendhfsf2@PLT -; CHECK-NEXT:cvttss2si %xmm0, %eax -; CHECK-NEXT:movd %eax, %xmm0 -; CHECK-NEXT:punpckldq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload +; CHECK-NEXT:unpcklps {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload ; CHECK-NEXT:# xmm0 = xmm0[0],mem[0],xmm0[1],mem[1] -; CHECK-NEXT:movdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill +; CHECK-NEXT:cvttps2dq %xmm0, %xmm0 +; CHECK-NEXT:movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill ; CHECK-NEXT:movdqa (%rsp), %xmm0 # 16-byte Reload ; CHECK-NEXT:psrldq {{.*#+}} xmm0 = xmm0[10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero ; CHECK-NEXT:callq __extendhfsf2@PLT -; CHECK-NEXT:cvttss2si %xmm0, %eax -; CHECK-NEXT:movd %eax, %xmm0 ; CHECK-NEXT:movdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill ; CHECK-NEXT:movaps (%rsp), %xmm0 # 16-byte Reload ; CHECK-NEXT:movhlps {{.*#+}} xmm0 = xmm0[1,1] ; CHECK-NEXT:callq __extendhfsf2@PLT -; CHECK-NEXT:cvttss2si %xmm0, %eax -; CHECK-NEXT:movd %eax, %xmm0 -; CHECK-NEXT:punpckldq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload +; CHECK-NEXT:
[llvm-branch-commits] [clang-tools-extra] 9c4cab0 - [clang-tidy][docs] Fixed page title for abseil-no-internal-dependencies check documentation
Author: Vladimir Plyashkun Date: 2022-08-15T09:31:34+02:00 New Revision: 9c4cab01e51e17635dfa5dff31c893980f701796 URL: https://github.com/llvm/llvm-project/commit/9c4cab01e51e17635dfa5dff31c893980f701796 DIFF: https://github.com/llvm/llvm-project/commit/9c4cab01e51e17635dfa5dff31c893980f701796.diff LOG: [clang-tidy][docs] Fixed page title for abseil-no-internal-dependencies check documentation It seems that documentation for abseil-no-internal-dependencies has invalid title. This can be checked by looking at the actual web-site - https://clang.llvm.org/extra/clang-tidy/checks/abseil/no-internal-dependencies.html There is redundant "subl.. title:: clang-tidy - abseil-no-internal-dependencies" paragraph in the beginning. Reviewed By: njames93, sylvestre.ledru Differential Revision: https://reviews.llvm.org/D131590 (cherry picked from commit 6c7b049f6eb78edf83506a858c7b211a7c70afd8) Added: Modified: clang-tools-extra/docs/clang-tidy/checks/abseil/no-internal-dependencies.rst Removed: diff --git a/clang-tools-extra/docs/clang-tidy/checks/abseil/no-internal-dependencies.rst b/clang-tools-extra/docs/clang-tidy/checks/abseil/no-internal-dependencies.rst index 3ddb023db8baf..c06057b313da5 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/abseil/no-internal-dependencies.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/abseil/no-internal-dependencies.rst @@ -1,4 +1,4 @@ -subl.. title:: clang-tidy - abseil-no-internal-dependencies +.. title:: clang-tidy - abseil-no-internal-dependencies abseil-no-internal-dependencies === ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 804e453 - [X86] Add RDPRU instruction CPUID bit masks
Author: Simon Pilgrim Date: 2022-08-15T09:31:26+02:00 New Revision: 804e4538577fe667454285c88f212abfe58516d5 URL: https://github.com/llvm/llvm-project/commit/804e4538577fe667454285c88f212abfe58516d5 DIFF: https://github.com/llvm/llvm-project/commit/804e4538577fe667454285c88f212abfe58516d5.diff LOG: [X86] Add RDPRU instruction CPUID bit masks As mentioned on D128934 - we weren't including the CPUID bit handling for the RDPRU instruction AMD's APMv3 (24594) lists it as CPUID Fn8000_0008_EBX Bit#4 (cherry picked from commit 08a880509e4f7ca8d346dce42fe7528c3a33f22c) Added: Modified: clang/lib/Headers/cpuid.h llvm/lib/Support/Host.cpp Removed: diff --git a/clang/lib/Headers/cpuid.h b/clang/lib/Headers/cpuid.h index 5d262a60735f2..caa0069c2e1fa 100644 --- a/clang/lib/Headers/cpuid.h +++ b/clang/lib/Headers/cpuid.h @@ -232,6 +232,7 @@ /* Features in %ebx for leaf 0x8008 */ #define bit_CLZERO 0x0001 +#define bit_RDPRU 0x0010 #define bit_WBNOINVD0x0200 diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp index c97f273b07398..94a1536f46900 100644 --- a/llvm/lib/Support/Host.cpp +++ b/llvm/lib/Support/Host.cpp @@ -1734,6 +1734,7 @@ bool sys::getHostCPUFeatures(StringMap ) { bool HasExtLeaf8 = MaxExtLevel >= 0x8008 && !getX86CpuIDAndInfo(0x8008, , , , ); Features["clzero"] = HasExtLeaf8 && ((EBX >> 0) & 1); + Features["rdpru"]= HasExtLeaf8 && ((EBX >> 4) & 1); Features["wbnoinvd"] = HasExtLeaf8 && ((EBX >> 9) & 1); bool HasLeaf7 = ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 76522bf - [clang][X86] Add RDPRU predefined macro tests for znver2/znver3 targets
Author: Simon Pilgrim Date: 2022-08-15T09:31:26+02:00 New Revision: 76522bf130996b9abe0029310d41e491832bced3 URL: https://github.com/llvm/llvm-project/commit/76522bf130996b9abe0029310d41e491832bced3 DIFF: https://github.com/llvm/llvm-project/commit/76522bf130996b9abe0029310d41e491832bced3.diff LOG: [clang][X86] Add RDPRU predefined macro tests for znver2/znver3 targets These were missed in D128934 (cherry picked from commit 6e19e6ce36e44554ac9fbf8b2780de05e922c849) Added: Modified: clang/test/Preprocessor/predefined-arch-macros.c Removed: diff --git a/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c index 6384b139c4054..0ffa2739e5df4 100644 --- a/clang/test/Preprocessor/predefined-arch-macros.c +++ b/clang/test/Preprocessor/predefined-arch-macros.c @@ -3216,6 +3216,7 @@ // CHECK_ZNVER2_M32: #define __POPCNT__ 1 // CHECK_ZNVER2_M32: #define __PRFCHW__ 1 // CHECK_ZNVER2_M32: #define __RDPID__ 1 +// CHECK_ZNVER2_M32: #define __RDPRU__ 1 // CHECK_ZNVER2_M32: #define __RDRND__ 1 // CHECK_ZNVER2_M32: #define __RDSEED__ 1 // CHECK_ZNVER2_M32: #define __SHA__ 1 @@ -3266,6 +3267,7 @@ // CHECK_ZNVER2_M64: #define __POPCNT__ 1 // CHECK_ZNVER2_M64: #define __PRFCHW__ 1 // CHECK_ZNVER2_M64: #define __RDPID__ 1 +// CHECK_ZNVER2_M64: #define __RDPRU__ 1 // CHECK_ZNVER2_M64: #define __RDRND__ 1 // CHECK_ZNVER2_M64: #define __RDSEED__ 1 // CHECK_ZNVER2_M64: #define __SHA__ 1 @@ -3318,6 +3320,7 @@ // CHECK_ZNVER3_M32: #define __POPCNT__ 1 // CHECK_ZNVER3_M32: #define __PRFCHW__ 1 // CHECK_ZNVER3_M32: #define __RDPID__ 1 +// CHECK_ZNVER3_M32: #define __RDPRU__ 1 // CHECK_ZNVER3_M32: #define __RDRND__ 1 // CHECK_ZNVER3_M32: #define __RDSEED__ 1 // CHECK_ZNVER3_M32: #define __SHA__ 1 @@ -3368,6 +3371,7 @@ // CHECK_ZNVER3_M64: #define __POPCNT__ 1 // CHECK_ZNVER3_M64: #define __PRFCHW__ 1 // CHECK_ZNVER3_M64: #define __RDPID__ 1 +// CHECK_ZNVER3_M64: #define __RDPRU__ 1 // CHECK_ZNVER3_M64: #define __RDRND__ 1 // CHECK_ZNVER3_M64: #define __RDSEED__ 1 // CHECK_ZNVER3_M64: #define __SHA__ 1 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] ab09289 - [libcxx] [test] Fix max_size.pass.cpp for PowerPC targets
Author: Amy Kwan Date: 2022-08-15T09:31:19+02:00 New Revision: ab09289dbf1d08db83e16314cf425d25c0138e66 URL: https://github.com/llvm/llvm-project/commit/ab09289dbf1d08db83e16314cf425d25c0138e66 DIFF: https://github.com/llvm/llvm-project/commit/ab09289dbf1d08db83e16314cf425d25c0138e66.diff LOG: [libcxx] [test] Fix max_size.pass.cpp for PowerPC targets This patch fixes the max_size.pass.cpp test for PowerPC targets, depending on endianness. We will exhibit the full_size() behaviour for little endian (where __endian_factor = 2 ), and the half_size() behaviour for big endian (where __endian_factor = 1). Differential Revision: https://reviews.llvm.org/D131682 (cherry picked from commit e2e9e2ce8efd12f0f2b7a12be113d4241706ddf2) Added: Modified: libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp Removed: diff --git a/libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp index 0f7e17cb4ab7f..3f3ed5baf1f4a 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp @@ -74,7 +74,13 @@ bool test() { # else full_size(); # endif -# elif defined(__powerpc__) || defined(__powerpc64__) || defined(__sparc64__) +# elif defined(__powerpc__) || defined(__powerpc64__) +# ifdef __BIG_ENDIAN__ + half_size(); +# else + full_size(); +# endif +# elif defined(__sparc64__) half_size(); # elif defined(_WIN32) full_size(); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [openmp] 6ce4369 - [OpenMP][FIX] Ensure __kmpc_kernel_parallel is reachable
Author: Johannes Doerfert Date: 2022-08-15T09:31:09+02:00 New Revision: 6ce43697482ea0c841f0cf614fcda09ceeb325a9 URL: https://github.com/llvm/llvm-project/commit/6ce43697482ea0c841f0cf614fcda09ceeb325a9 DIFF: https://github.com/llvm/llvm-project/commit/6ce43697482ea0c841f0cf614fcda09ceeb325a9.diff LOG: [OpenMP][FIX] Ensure __kmpc_kernel_parallel is reachable The problem is we create the call to __kmpc_kernel_parallel in the openmp-opt pass but while we optimize the code, the call is not there yet. Thus, we assume we never reach it from __kmpc_target_deinit. That allows us to remove the store in there (`ParallelRegionFn = nullptr`), which leads to bad results later on. This is a shortstop solution until we come up with something better. Fixes https://github.com/llvm/llvm-project/issues/57064 (cherry picked from commit a8cda3290944687b4fd0138e63cd980ea497a438) Added: Modified: openmp/libomptarget/DeviceRTL/src/Kernel.cpp Removed: diff --git a/openmp/libomptarget/DeviceRTL/src/Kernel.cpp b/openmp/libomptarget/DeviceRTL/src/Kernel.cpp index 74c22a61f3b88..d682652830a03 100644 --- a/openmp/libomptarget/DeviceRTL/src/Kernel.cpp +++ b/openmp/libomptarget/DeviceRTL/src/Kernel.cpp @@ -35,7 +35,7 @@ static void genericStateMachine(IdentTy *Ident) { uint32_t TId = mapping::getThreadIdInBlock(); do { -ParallelRegionFnTy WorkFn = 0; +ParallelRegionFnTy WorkFn = nullptr; // Wait for the signal that we have a new work function. synchronize::threads(); @@ -100,8 +100,20 @@ int32_t __kmpc_target_init(IdentTy *Ident, int8_t Mode, // doing any work. mapping::getBlockSize() does not include any of the main // thread's warp, so none of its threads can ever be active worker threads. if (UseGenericStateMachine && - mapping::getThreadIdInBlock() < mapping::getBlockSize(IsSPMD)) + mapping::getThreadIdInBlock() < mapping::getBlockSize(IsSPMD)) { genericStateMachine(Ident); + } else { +// Retrieve the work function just to ensure we always call +// __kmpc_kernel_parallel even if a custom state machine is used. +// TODO: this is not super pretty. The problem is we create the call to +// __kmpc_kernel_parallel in the openmp-opt pass but while we optimize it is +// not there yet. Thus, we assume we never reach it from +// __kmpc_target_deinit. That allows us to remove the store in there to +// ParallelRegionFn, which leads to bad results later on. +ParallelRegionFnTy WorkFn = nullptr; +__kmpc_kernel_parallel(); +ASSERT(WorkFn == nullptr); + } return mapping::getThreadIdInBlock(); } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] a9ac5ac - [Clang][OpenMP] Fix the issue that `llvm.lifetime.end` is emitted too early for variables captured in linear clause
Author: Shilei Tian Date: 2022-08-15T09:31:02+02:00 New Revision: a9ac5ac72816978bcf1a9d11def8e57dee25d330 URL: https://github.com/llvm/llvm-project/commit/a9ac5ac72816978bcf1a9d11def8e57dee25d330 DIFF: https://github.com/llvm/llvm-project/commit/a9ac5ac72816978bcf1a9d11def8e57dee25d330.diff LOG: [Clang][OpenMP] Fix the issue that `llvm.lifetime.end` is emitted too early for variables captured in linear clause Currently if an OpenMP program uses `linear` clause, and is compiled with optimization, `llvm.lifetime.end` for variables listed in `linear` clause are emitted too early such that there could still be uses after that. Let's take the following code as example: ``` // loop.c int j; int *u; void loop(int n) { int i; for (i = 0; i < n; ++i) { ++j; u = } } ``` We compile using the command: ``` clang -cc1 -fopenmp-simd -O3 -x c -triple x86_64-apple-darwin10 -emit-llvm loop.c -o loop.ll ``` The following IR (simplified) will be generated: ``` @j = local_unnamed_addr global i32 0, align 4 @u = local_unnamed_addr global ptr null, align 8 define void @loop(i32 noundef %n) local_unnamed_addr { entry: %j = alloca i32, align 4 %cmp = icmp sgt i32 %n, 0 br i1 %cmp, label %simd.if.then, label %simd.if.end simd.if.then: ; preds = %entry call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j) store ptr %j, ptr @u, align 8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) %0 = load i32, ptr %j, align 4 store i32 %0, ptr @j, align 4 br label %simd.if.end simd.if.end: ; preds = %simd.if.then, %entry ret void } ``` The most important part is: ``` call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) %0 = load i32, ptr %j, align 4 store i32 %0, ptr @j, align 4 ``` `%j` is still loaded after `@llvm.lifetime.end.p0(i64 4, ptr nonnull %j)`. This could cause the backend incorrectly optimizes the code and further generates incorrect code. The root cause is, when we emit a construct that could have `linear` clause, it usually has the following pattern: ``` EmitOMPLinearClauseInit(S) { OMPPrivateScope LoopScope(*this); ... EmitOMPLinearClause(S, LoopScope); ... (void)LoopScope.Privatize(); ... } EmitOMPLinearClauseFinal(S, [](CodeGenFunction &) { return nullptr; }); ``` Variables that need to be privatized are added into `LoopScope`, which also serves as a RAII object. When `LoopScope` is destructed and if optimization is enabled, a `@llvm.lifetime.end` is also emitted for each privatized variable. However, the writing back to original variables in `linear` clause happens after the scope in `EmitOMPLinearClauseFinal`, causing the issue we see above. A quick "fix" seems to be, moving `EmitOMPLinearClauseFinal` inside the scope. However, it doesn't work. That's because the local variable map has been updated by `LoopScope` such that a variable declaration is mapped to the privatized variable, instead of the actual one. In that way, the following code will be generated: ``` %0 = load i32, ptr %j, align 4 store i32 %0, ptr %j, align 4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) ``` Well, now the life time is correct, but apparently the writing back is broken. In this patch, a new function `OMPPrivateScope::restoreMap` is added and called before calling `EmitOMPLinearClauseFinal`. This can make sure that `EmitOMPLinearClauseFinal` can find the orignal varaibls to write back. Fixes #56913. Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D131272 (cherry picked from commit e21202dac18ed7f718d26a0e131f96b399b4891c) Added: clang/test/OpenMP/bug56913.c Modified: clang/lib/CodeGen/CGStmtOpenMP.cpp clang/lib/CodeGen/CodeGenFunction.h clang/test/OpenMP/for_linear_codegen.cpp clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp Removed: diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index aa55cdaca5dca..570424dae7fc8 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -2582,8 +2582,9 @@ static void emitOMPSimdRegion(CodeGenFunction , const OMPLoopDirective , CGF.EmitOMPReductionClauseFinal(S, /*ReductionKind=*/OMPD_simd); emitPostUpdateForReductionClause(CGF, S, [](CodeGenFunction &) { return nullptr; }); +LoopScope.restoreMap(); +CGF.EmitOMPLinearClauseFinal(S, [](CodeGenFunction &) { return nullptr; }); } - CGF.EmitOMPLinearClauseFinal(S, [](CodeGenFunction &) { return nullptr; }); // Emit: if (PreCond) - end. if (ContBlock) { CGF.EmitBranch(ContBlock); @@ -3426,11 +3427,12 @@ bool CodeGenFunction::EmitOMPWorksharingLoop( EmitOMPLastprivateClauseFinal( S, isOpenMPSimdDirective(S.getDirectiveKind()),
[llvm-branch-commits] [clang] aa20ed6 - [clang][AArch64][SVE] Clarify documentation for sizeof operator on SVE
Author: David Truby Date: 2022-08-15T09:30:54+02:00 New Revision: aa20ed6187b7300ef627ff4c28d8150c41cafb54 URL: https://github.com/llvm/llvm-project/commit/aa20ed6187b7300ef627ff4c28d8150c41cafb54 DIFF: https://github.com/llvm/llvm-project/commit/aa20ed6187b7300ef627ff4c28d8150c41cafb54.diff LOG: [clang][AArch64][SVE] Clarify documentation for sizeof operator on SVE Previously the table in LanguageExtensions said that sizeof worked on SVE types but this is only correct for fixed-length vectors so a clarification has been added. (cherry picked from commit bbb30bd54a6447702f9f59a2ae4c478eb7133ae0) Added: Modified: clang/docs/LanguageExtensions.rst Removed: diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index 86e88b19d7df..6b8b88020ed0 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -552,7 +552,7 @@ bitwise operators &,|,^,~yes yes yes yesyes ==, !=, >, <, >=, <= yes yes yes yesyes =yes yes yes yesyes ?: [#]_ yes --yes yesyes -sizeof yes yes yes yesyes +sizeof yes yes yes yesyes [#]_ C-style cast yes yes yes no no reinterpret_cast yes noyes no no static_cast yes noyes no no @@ -568,6 +568,7 @@ See also :ref:`langext-__builtin_shufflevector`, :ref:`langext-__builtin_convert conversions (that is, != 0). If it's an extension (OpenCL) vector, it's only available in C and OpenCL C. And it selects base on signedness of the condition operands (OpenCL v1.1 s6.3.9). +.. [#] sizeof can only be used on vector length specific SVE types. .. [#] Clang does not allow the address of an element to be taken while GCC allows this. This is intentional for vectors with a boolean element type and not implemented otherwise. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 5932bf1 - [clang][AArch64][SVE] Change SVE_VECTOR_OPERATORS macro for VLA vectors
Author: David Truby Date: 2022-08-15T09:30:54+02:00 New Revision: 5932bf1730629a1c2673cfdd31d5d823e62a33c3 URL: https://github.com/llvm/llvm-project/commit/5932bf1730629a1c2673cfdd31d5d823e62a33c3 DIFF: https://github.com/llvm/llvm-project/commit/5932bf1730629a1c2673cfdd31d5d823e62a33c3.diff LOG: [clang][AArch64][SVE] Change SVE_VECTOR_OPERATORS macro for VLA vectors The __ARM_FEATURE_SVE_VECTOR_OPERATORS macro should be changed to indicate that this feature is now supported on VLA vectors as well as VLS vectors. There is a complementary PR to the ACLE spec here https://github.com/ARM-software/acle/pull/213 Reviewed By: peterwaller-arm Differential Revision: https://reviews.llvm.org/D131573 (cherry picked from commit 13a784f368ef062a7bd652829bcf8bbdd94dc659) Added: Modified: clang/lib/Basic/Targets/AArch64.cpp clang/test/Preprocessor/aarch64-target-features.c Removed: diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp index 60ef52ac3f0dd..8d8972c1613a9 100644 --- a/clang/lib/Basic/Targets/AArch64.cpp +++ b/clang/lib/Basic/Targets/AArch64.cpp @@ -489,9 +489,12 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions , Builder.defineMacro("__FP_FAST_FMA", "1"); Builder.defineMacro("__FP_FAST_FMAF", "1"); + // C/C++ operators work on both VLS and VLA SVE types + if (FPU & SveMode) +Builder.defineMacro("__ARM_FEATURE_SVE_VECTOR_OPERATORS", "2"); + if (Opts.VScaleMin && Opts.VScaleMin == Opts.VScaleMax) { Builder.defineMacro("__ARM_FEATURE_SVE_BITS", Twine(Opts.VScaleMin * 128)); -Builder.defineMacro("__ARM_FEATURE_SVE_VECTOR_OPERATORS"); } } diff --git a/clang/test/Preprocessor/aarch64-target-features.c b/clang/test/Preprocessor/aarch64-target-features.c index 6e495a0ae96e7..2d4ec2bbcae92 100644 --- a/clang/test/Preprocessor/aarch64-target-features.c +++ b/clang/test/Preprocessor/aarch64-target-features.c @@ -150,6 +150,7 @@ // RUN: %clang -target aarch64-none-linux-gnu -march=armv8-a+sve -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SVE %s // CHECK-SVE: __ARM_FEATURE_SVE 1 +// CHECK-SVE: __ARM_FEATURE_SVE_VECTOR_OPERATORS 2 // RUN: %clang -target aarch64-none-linux-gnu -march=armv8-a+sve+bf16 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SVE-BF16 %s // CHECK-SVE-BF16: __ARM_FEATURE_BF16_SCALAR_ARITHMETIC 1 @@ -512,9 +513,7 @@ // RUN: %clang -target aarch64-arm-none-eabi -march=armv8-a+sve -msve-vector-bits=2048 -x c -E -dM %s -o - 2>&1 | FileCheck -check-prefix=CHECK-SVE-VECTOR-BITS -D#VBITS=2048 %s // RUN: %clang -target aarch64-arm-none-eabi -march=armv8-a+sve -msve-vector-bits=512+ -x c -E -dM %s -o - 2>&1 | FileCheck -check-prefix=CHECK-NO-SVE-VECTOR-BITS %s // CHECK-SVE-VECTOR-BITS: __ARM_FEATURE_SVE_BITS [[#VBITS:]] -// CHECK-SVE-VECTOR-BITS: __ARM_FEATURE_SVE_VECTOR_OPERATORS 1 // CHECK-NO-SVE-VECTOR-BITS-NOT: __ARM_FEATURE_SVE_BITS -// CHECK-NO-SVE-VECTOR-BITS-NOT: __ARM_FEATURE_SVE_VECTOR_OPERATORS // == Check Large System Extensions (LSE) // RUN: %clang -target aarch64-none-linux-gnu -march=armv8-a+lse -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-LSE %s ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 5c6590e - [clang] Correct documentation for NEON and SVE operator support
Author: David Truby Date: 2022-08-15T09:30:54+02:00 New Revision: 5c6590eb2775a545ad37c38c1c1f440e5687b079 URL: https://github.com/llvm/llvm-project/commit/5c6590eb2775a545ad37c38c1c1f440e5687b079 DIFF: https://github.com/llvm/llvm-project/commit/5c6590eb2775a545ad37c38c1c1f440e5687b079.diff LOG: [clang] Correct documentation for NEON and SVE operator support Previously the language extension documentation didn't mention SVE and was incomplete in listing the C/C++ operators supported on NEON. This corrects the documentation to be in line with the implementation. (cherry picked from commit e4642d78a89930720bc84a4775614c45327bc0dc) Added: Modified: clang/docs/LanguageExtensions.rst Removed: diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index 259983271f345..86e88b19d7df1 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -400,7 +400,7 @@ Builtin Macros Vectors and Extended Vectors -Supports the GCC, OpenCL, AltiVec and NEON vector extensions. +Supports the GCC, OpenCL, AltiVec, NEON and SVE vector extensions. OpenCL vector types are created using the ``ext_vector_type`` attribute. It supports the ``V.xyzw`` syntax and other tidbits as seen in OpenCL. An example @@ -539,32 +539,33 @@ The table below shows the support for each operation by vector extension. A dash indicates that an operation is not accepted according to a corresponding specification. -== === === = === - Operator OpenCL AltiVec GCCNEON -== === === = === -[] yes yes yes -- -unary operators +, --yes yes yes -- -++, -- --yes yes yes -- -+,--,*,/,% yes yes yes -- -bitwise operators &,|,^,~yes yes yes -- ->>,<, <, >=, <= yes yes yes -- -=yes yes yes yes -?: [#]_ yes --yes -- -sizeof yes yes yes yes -C-style cast yes yes yes no -reinterpret_cast yes noyes no -static_cast yes noyes no -const_cast no nono no -address [i]no nono [#]_ no -== === === = === +== === === = === = + Operator OpenCL AltiVec GCCNEONSVE +== === === = === = +[] yes yes yes yesyes +unary operators +, --yes yes yes yesyes +++, -- --yes yes yes no no ++,--,*,/,% yes yes yes yesyes +bitwise operators &,|,^,~yes yes yes yesyes +>>,< , <, >=, <= yes yes yes yesyes +=yes yes yes yesyes +?: [#]_ yes --yes yesyes +sizeof yes yes yes yesyes +C-style cast yes yes yes no no +reinterpret_cast yes noyes no no +static_cast yes noyes no no +const_cast no nono no no +address [i]no nono [#]_ no no +== === === = === = See also :ref:`langext-__builtin_shufflevector`, :ref:`langext-__builtin_convertvector`. .. [#] ternary operator(?:) has diff erent behaviors depending on condition operand's vector type. If the condition is a GNU vector (i.e. __vector_size__), - it's only available in C++ and uses normal bool conversions (that is, != 0). + a NEON vector or an SVE vector, it's only available in C++ and uses normal bool + conversions (that is, != 0). If it's an extension (OpenCL) vector, it's only available in C and OpenCL C. And it selects
[llvm-branch-commits] [clang] 2c3f5d7 - [clang][AArch64][SVE] Add unary +/- operators for SVE types
Author: David Truby Date: 2022-08-15T09:30:54+02:00 New Revision: 2c3f5d71e3118d67ccd0c988bcc1f9bc0710574c URL: https://github.com/llvm/llvm-project/commit/2c3f5d71e3118d67ccd0c988bcc1f9bc0710574c DIFF: https://github.com/llvm/llvm-project/commit/2c3f5d71e3118d67ccd0c988bcc1f9bc0710574c.diff LOG: [clang][AArch64][SVE] Add unary +/- operators for SVE types This patch enables the unary promotion and negation operators on SVE types. Differential Revision: https://reviews.llvm.org/D130984 (cherry picked from commit 286d59ef6f7118c8a0600f3d281593700528a5d3) Added: Modified: clang/lib/Sema/SemaExpr.cpp clang/test/CodeGen/aarch64-sve-vector-arith-ops.c clang/test/Sema/sizeless-1.c clang/test/SemaCXX/sizeless-1.cpp Removed: diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 0f79978b0911c..0e24237faae5b 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -15603,6 +15603,8 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc, resultType->castAs()->getVectorKind() != VectorType::AltiVecBool)) break; +else if (resultType->isVLSTBuiltinType()) // SVE vectors allow + and - + break; else if (getLangOpts().CPlusPlus && // C++ [expr.unary.op]p6 Opc == UO_Plus && resultType->isPointerType()) diff --git a/clang/test/CodeGen/aarch64-sve-vector-arith-ops.c b/clang/test/CodeGen/aarch64-sve-vector-arith-ops.c index c57c476032025..d7c79d7a44220 100644 --- a/clang/test/CodeGen/aarch64-sve-vector-arith-ops.c +++ b/clang/test/CodeGen/aarch64-sve-vector-arith-ops.c @@ -1650,3 +1650,143 @@ svuint32_t rem_scalar_u32(svuint32_t a, uint32_t b) { svuint64_t rem_scalar_u64(svuint64_t a, uint64_t b) { return a % b; } + +// UNARY PROMOTION + +// CHECK-LABEL: @prom_i8( +// CHECK-NEXT: entry: +// CHECK-NEXT:ret [[A:%.*]] +// +svint8_t prom_i8(svint8_t a) { + return +a; +} + +// CHECK-LABEL: @prom_i16( +// CHECK-NEXT: entry: +// CHECK-NEXT:ret [[A:%.*]] +// +svint16_t prom_i16(svint16_t a) { + return +a; +} + +// CHECK-LABEL: @prom_i32( +// CHECK-NEXT: entry: +// CHECK-NEXT:ret [[A:%.*]] +// +svint32_t prom_i32(svint32_t a) { + return +a; +} + +// CHECK-LABEL: @prom_i64( +// CHECK-NEXT: entry: +// CHECK-NEXT:ret [[A:%.*]] +// +svint64_t prom_i64(svint64_t a) { + return +a; +} + +// CHECK-LABEL: @prom_u8( +// CHECK-NEXT: entry: +// CHECK-NEXT:ret [[A:%.*]] +// +svuint8_t prom_u8(svuint8_t a) { + return +a; +} + +// CHECK-LABEL: @prom_u16( +// CHECK-NEXT: entry: +// CHECK-NEXT:ret [[A:%.*]] +// +svuint16_t prom_u16(svuint16_t a) { + return +a; +} + +// CHECK-LABEL: @prom_u32( +// CHECK-NEXT: entry: +// CHECK-NEXT:ret [[A:%.*]] +// +svuint32_t prom_u32(svuint32_t a) { + return +a; +} + +// CHECK-LABEL: @prom_u64( +// CHECK-NEXT: entry: +// CHECK-NEXT:ret [[A:%.*]] +// +svuint64_t prom_u64(svuint64_t a) { + return +a; +} + +// UNARY NEGATION + +// CHECK-LABEL: @neg_i8( +// CHECK-NEXT: entry: +// CHECK-NEXT:[[SUB:%.*]] = sub zeroinitializer, [[A:%.*]] +// CHECK-NEXT:ret [[SUB]] +// +svint8_t neg_i8(svint8_t a) { + return -a; +} + +// CHECK-LABEL: @neg_i16( +// CHECK-NEXT: entry: +// CHECK-NEXT:[[SUB:%.*]] = sub zeroinitializer, [[A:%.*]] +// CHECK-NEXT:ret [[SUB]] +// +svint16_t neg_i16(svint16_t a) { + return -a; +} + +// CHECK-LABEL: @neg_i32( +// CHECK-NEXT: entry: +// CHECK-NEXT:[[SUB:%.*]] = sub zeroinitializer, [[A:%.*]] +// CHECK-NEXT:ret [[SUB]] +// +svint32_t neg_i32(svint32_t a) { + return -a; +} + +// CHECK-LABEL: @neg_i64( +// CHECK-NEXT: entry: +// CHECK-NEXT:[[SUB:%.*]] = sub zeroinitializer, [[A:%.*]] +// CHECK-NEXT:ret [[SUB]] +// +svint64_t neg_i64(svint64_t a) { + return -a; +} + +// CHECK-LABEL: @neg_u8( +// CHECK-NEXT: entry: +// CHECK-NEXT:[[SUB:%.*]] = sub zeroinitializer, [[A:%.*]] +// CHECK-NEXT:ret [[SUB]] +// +svuint8_t neg_u8(svuint8_t a) { + return -a; +} + +// CHECK-LABEL: @neg_u16( +// CHECK-NEXT: entry: +// CHECK-NEXT:[[SUB:%.*]] = sub zeroinitializer, [[A:%.*]] +// CHECK-NEXT:ret [[SUB]] +// +svuint16_t neg_u16(svuint16_t a) { + return -a; +} + +// CHECK-LABEL: @neg_u32( +// CHECK-NEXT: entry: +// CHECK-NEXT:[[SUB:%.*]] = sub zeroinitializer, [[A:%.*]] +// CHECK-NEXT:ret [[SUB]] +// +svuint32_t neg_u32(svuint32_t a) { + return -a; +} + +// CHECK-LABEL: @neg_u64( +// CHECK-NEXT: entry: +// CHECK-NEXT:[[SUB:%.*]] = sub zeroinitializer, [[A:%.*]] +// CHECK-NEXT:ret [[SUB]] +// +svuint64_t neg_u64(svuint64_t a) { + return -a; +} diff --git a/clang/test/Sema/sizeless-1.c b/clang/test/Sema/sizeless-1.c index 5e7e3be772e8c..64af214d206b9 100644 --- a/clang/test/Sema/sizeless-1.c +++ b/clang/test/Sema/sizeless-1.c @@ -187,10 +187,8 @@ void func(int sel) { global_int8_ptr -= 1; //
[llvm-branch-commits] [clang] 4683a45 - Fix assert during the call to getCanonicalDecl.
Author: Jennifer Yu Date: 2022-08-15T09:30:40+02:00 New Revision: 4683a4561c2513ae7384aa9fd752f45a72eecc83 URL: https://github.com/llvm/llvm-project/commit/4683a4561c2513ae7384aa9fd752f45a72eecc83 DIFF: https://github.com/llvm/llvm-project/commit/4683a4561c2513ae7384aa9fd752f45a72eecc83.diff LOG: Fix assert during the call to getCanonicalDecl. https://github.com/llvm/llvm-project/issues/56884 The root problem is in isOpenMPRebuildMemberExpr, it is only need to rebuild for field expression. No need for member function call. The fix is to check field for member expression and skip rebuild for member function call. Differential Revision: https://reviews.llvm.org/D131024 (cherry picked from commit a7bca18bc50cd2483fded0c77706980b2721ce6a) Added: Modified: clang/lib/Sema/SemaOpenMP.cpp clang/test/OpenMP/parallel_default_messages.cpp Removed: diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index dc1470bf7a9d1..a92fec6a02323 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -2270,6 +2270,9 @@ bool Sema::isInOpenMPTargetExecutionDirective() const { } bool Sema::isOpenMPRebuildMemberExpr(ValueDecl *D) { + // Only rebuild for Field. + if (!dyn_cast(D)) +return false; DSAStackTy::DSAVarData DVarPrivate = DSAStack->hasDSA( D, [](OpenMPClauseKind C, bool AppliedToPointee, diff --git a/clang/test/OpenMP/parallel_default_messages.cpp b/clang/test/OpenMP/parallel_default_messages.cpp index 7db15d7267317..65e0d92c32fc2 100644 --- a/clang/test/OpenMP/parallel_default_messages.cpp +++ b/clang/test/OpenMP/parallel_default_messages.cpp @@ -49,3 +49,10 @@ int main(int argc, char **argv) { return 0; } + +class A{ + void a() { +#pragma omp parallel +a(b); // expected-error {{use of undeclared identifier 'b'}} + } +}; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits