llvm-project/clang/lib
cchen d0d43b58b1 [OpenMP] target nested `use_device_ptr() if()` and is_device_ptr trigger asserts
Clang now asserts for the below case:
```
void clang::CodeGen::CGOpenMPRuntime::createOffloadEntriesAndInfoMetadata(): Assertion `std::get<0>(E) && "All ordered entries must exist!"' failed.
```

The reason why Clang hit the assert is because in
`emitTargetDataCalls`, both `BeginThenGen` and `BeginElseGen` call
`registerTargetRegionEntryInfo` and try to register the Entry in
OffloadEntriesTargetRegion with same key. If changing the expression in
if clause to any constant expression, then the assert disappear. (https://godbolt.org/z/TW7haj)

The assert itself is to avoid
user from accessing elements out of bound inside `OrderedEntries` in
`createOffloadEntriesAndInfoMetadata`.

In this patch, I add a check in `registerTargetRegionEntryInfo` to avoid
register the target region more than once.

A test case that triggers assert: https://godbolt.org/z/4cnGW8

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D90704
2020-11-04 12:36:57 -06:00
..
ARCMigrate [clang] Use SourceLocation as key in hash maps, NFCI 2020-10-20 16:24:09 +01:00
AST Undo Revert "Ignore template instantiations if not in AsIs mode" 2020-11-03 13:59:01 -08:00
ASTMatchers Undo Revert "Ignore template instantiations if not in AsIs mode" 2020-11-03 13:59:01 -08:00
Analysis Thread safety analysis: Consider static class members as inaccessible 2020-10-30 00:35:14 +01:00
Basic [AMDGPU] Add gfx1033 target 2020-11-03 16:27:48 +00:00
CodeGen [OpenMP] target nested `use_device_ptr() if()` and is_device_ptr trigger asserts 2020-11-04 12:36:57 -06:00
CrossTU [analyzer] Add CTUImportCppThreshold for C++ files 2020-07-09 15:36:33 +02:00
DirectoryWatcher Revert "DirectoryWatcher: add an implementation for Windows" 2020-10-13 12:35:22 -07:00
Driver [compiler-rt][AIX]: Link compiler-rt profile library when -fprofile-generate is specified 2020-11-04 09:54:54 -05:00
Edit [clang] Use SourceLocation as key in hash maps, NFCI 2020-10-20 16:24:09 +01:00
Format [clang-format] Improve BAS_DontAlign+AllowAllArgumentsOnNextLine=false 2020-11-02 17:52:37 +00:00
Frontend Reland - [Clang] Add the ability to map DLL storage class to visibility 2020-11-02 23:24:49 +00:00
FrontendTool [NFC] Refactor Registry loops to range for 2020-06-19 00:40:10 +01:00
Headers [HIP] Math Headers to use type promotion 2020-11-03 18:40:26 +00:00
Index [Clang][PowerPC] Add __vector_pair and __vector_quad types 2020-10-28 13:19:20 -05:00
IndexSerialization [index-while-building] Fix build with -DBUILD_SHARED_LIBS=True 2020-08-20 15:12:56 +01:00
Lex HeaderSearch: Simplify use of FileEntryRef in HeaderSearch::LookupFile, NFC 2020-10-23 22:10:50 -04:00
Parse Add option 'exceptions' to pragma clang fp 2020-10-31 17:36:12 +07:00
Rewrite SourceManager: Clarify that FileInfo always has a ContentCache, NFC 2020-10-23 12:38:53 -04:00
Sema When re-checking an already-substituted template argument, don't lose 2020-11-03 14:09:54 -08:00
Serialization Fix build error on bots after 9f151df178 2020-11-02 15:55:13 -05:00
StaticAnalyzer [analyzer][ReturnPtrRangeChecker] Fix a false positive on end() iterator 2020-11-02 16:41:17 +01:00
Testing Fix MSVC "not all control paths return a value" warning. NFC. 2020-06-05 10:45:59 +01:00
Tooling [Syntax] DeclaratorList is a List 2020-11-03 03:29:06 +01:00
CMakeLists.txt Add an explicit toggle for the static analyzer in clang-tidy 2020-09-10 10:48:17 -04:00