aboutsummaryrefslogtreecommitdiff
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* [OpenCL] Accept .rgba in OpenCL 3.0Sven van Haastregt2021-04-123-9/+17
| | | | | | | | | | | | | | The .rgba vector component accessors are supported in OpenCL C 3.0. Previously, the diagnostic would check `OpenCLVersion` for version 2.2 (value 220) and report those accessors are an OpenCL 2.2 feature. However, there is no "OpenCL C version 2.2", so change the check and diagnostic text to 3.0 only. A spurious `OpenCLVersion` argument was passed into the diagnostic; remove that. Differential Revision: https://reviews.llvm.org/D99969
* [DebugInfo] Fix the mismatching between C++ language tags and Dwarf versions.Esme-Yi2021-04-123-3/+16
| | | | | | | | Summary: The tags DW_LANG_C_plus_plus_14 and DW_LANG_C_plus_plus_11, introduced in Dwarf-5, are unexpected in previous versions. Fixing the mismathing doesn't have any drawbacks for any other debuggers, but helps dbx. Reviewed By: aprantl, shchenz Differential Revision: https://reviews.llvm.org/D99250
* [clang][AST] Handle overload callee type in CallExpr::getCallReturnType.Balázs Kéri2021-04-122-0/+74
| | | | | | | | | | | | | | The function did not handle every case. In some cases this caused assertion failure. After the fix the function returns DependentTy if the exact return type can not be determined. It seems that clang itself does not call the function in the affected cases but some checker or other code may call it. Reviewed By: hokein Differential Revision: https://reviews.llvm.org/D95244
* [NFC] [Clang]: fix spelling mistake in assert messageJim Lin2021-04-121-1/+1
| | | | | | Reviewed By: Jim Differential Revision: https://reviews.llvm.org/D71541
* [X86] Remove FeatureCLWB from FeaturesICLClientFreddy Ye2021-04-121-2/+2
| | | | | | Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D100279
* [Clang][Coroutine][DebugInfo] In c++ coroutine, clang will emit different ↵yifeng.dongyifeng2021-04-127-13/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | debug info variables for parameters and move-parameters. The first one is the real parameters of the coroutine function, the other one just for copying parameters to the coroutine frame. Considering the following c++ code: ``` struct coro { ... }; coro foo(struct test & t) { ... co_await suspend_always(); ... co_await suspend_always(); ... co_await suspend_always(); } int main(int argc, char *argv[]) { auto c = foo(...); c.handle.resume(); ... } ``` Function foo is the standard coroutine function, and it has only one parameter named t (ignoring this at first), when we use the llvm code to compile this function, we can get the following ir: ``` !2921 = distinct !DISubprogram(name: "foo", linkageName: "_ZN6Object3fooE4test", scope: !2211, file: !45, li\ ne: 48, type: !2329, scopeLine: 48, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefi\ nition | DISPFlagOptimized, unit: !44, declaration: !2328, retainedNodes: !2922) !2924 = !DILocalVariable(name: "t", arg: 2, scope: !2921, file: !45, line: 48, type: !838) ... !2926 = !DILocalVariable(name: "t", scope: !2921, type: !838, flags: DIFlagArtificial) ``` We can find there are two `the same` DIVariable named t in the same dwarf scope for foo.resume. And when we try to use llvm-dwarfdump to dump the dwarf info of this elf, we get the following output: ``` 0x00006684: DW_TAG_subprogram DW_AT_low_pc (0x00000000004013a0) DW_AT_high_pc (0x00000000004013a8) DW_AT_frame_base (DW_OP_reg7 RSP) DW_AT_object_pointer (0x0000669c) DW_AT_GNU_all_call_sites (true) DW_AT_specification (0x00005b5c "_ZN6Object3fooE4test") 0x000066a5: DW_TAG_formal_parameter DW_AT_name ("t") DW_AT_decl_file ("/disk1/yifeng.dongyifeng/my_code/llvm/build/bin/coro-debug-1.cpp") DW_AT_decl_line (48) DW_AT_type (0x00004146 "test") 0x000066ba: DW_TAG_variable DW_AT_name ("t") DW_AT_type (0x00004146 "test") DW_AT_artificial (true) ``` The elf also has two 't' in the same scope. But unluckily, it might let the debugger confused. And failed to print parameters for O0 or above. This patch will make coroutine parameters and move parameters use the same DIVar and try to fix the problems that I mentioned before. Test Plan: check-clang Reviewed By: aprantl, jmorse Differential Revision: https://reviews.llvm.org/D97533
* [RISCV][Clang] Add some RVV Permutation intrinsic functions.Zakk Chen2021-04-1115-0/+22700
| | | | | | | | | | | | | | Support the following instructions. 1. Vector Slide Instructions 2. Vector Register Gather Instructions 3. Vector Compress Instruction Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com> Co-Authored-by: Zakk Chen <zakk.chen@sifive.com> Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D100127
* [RISCV][Clang] Add all RVV Mask intrinsic functions.Zakk Chen2021-04-1130-6/+5867
| | | | | | | | | | | | | | | 1. Redefine vpopc and vfirst IR intrinsic so it could adapt on clang tablegen generator which always appends a type for vl in IntrinsicType of clang codegen. 2. Remove `c` type transformer and add `u` and `l` for unsigned long and long type. Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com> Co-Authored-by: Zakk Chen <zakk.chen@sifive.com> Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D100120
* [RISCV][Clang] Add more RVV load/store intrinsic functions.Zakk Chen2021-04-1112-265/+33246
| | | | | | | | | | | | | | Support the following instructions. 1. Mask load and store 2. Vector Strided Instructions 3. Vector Indexed Store Instructions Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com> Co-Authored-by: Zakk Chen <zakk.chen@sifive.com> Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D99965
* [RISCV][Clang] Add all RVV Reduction intrinsic functions.Zakk Chen2021-04-1124-0/+21760
| | | | | | | | | Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com> Co-Authored-by: Zakk Chen <zakk.chen@sifive.com> Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D99964
* [RISCV][Clang] Add RVV merge intrinsic functions.Zakk Chen2021-04-113-3/+2943
| | | | | | | | | Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com> Co-Authored-by: Zakk Chen <zakk.chen@sifive.com> Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D99963
* [RISCV][Clang] Add RVV Type-Convert intrinsic functions.Zakk Chen2021-04-118-4/+8515
| | | | | | | | | | | | | Fix extension macro condition. Support below instructions: 1. Single-Width Floating-Point/Integer Type-Convert Instructions 2. Widening Floating-Point/Integer Type-Convert Instructions 3. Narrowing Floating-Point/Integer Type-Convert Instructions Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D99742
* [RISCV][Clang] Add some RVV Floating-Point intrinsic functions.Zakk Chen2021-04-1111-5/+2493
| | | | | | | | | | | Support vfclass, vfmerge, vfrec7, vfrsqrt7, vfsqrt instructions. Reviewed By: craig.topper Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com> Co-Authored-by: Zakk Chen <zakk.chen@sifive.com> Differential Revision: https://reviews.llvm.org/D99741
* [RISCV][Clang] Add more RVV Floating-Point intrinsic functions.Zakk Chen2021-04-1143-31/+19034
| | | | | | | | | | | | | | | | Support below instructions. 1. Vector Widening Floating-Point Add/Subtract Instructions 2. Vector Widening Floating-Point Multiply 3. Vector Single-Width Floating-Point Fused Multiply-Add Instructions 4. Vector Widening Floating-Point Fused Multiply-Add Instructions 5. Vector Floating-Point Compare Instructions Reviewed By: craig.topper, HsiangKai Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com> Co-Authored-by: Zakk Chen <zakk.chen@sifive.com> Differential Revision: https://reviews.llvm.org/D99669
* [RISCV][Clang] Add some RVV Floating-Point intrinsic functions.Zakk Chen2021-04-1117-0/+9926
| | | | | | | | | | | | | | | Support the following instructions which have the same class. 1. Vector Single-Width Floating-Point Subtract Instructions 2. Vector Single-Width Floating-Point Multiply/Divide Instructions 3. Vector Floating-Point MIN/MAX Instructions 4. Vector Floating-Point Sign-Injection Instructions Reviewed By: craig.topper Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com> Co-Authored-by: Zakk Chen <zakk.chen@sifive.com> Differential Revision: https://reviews.llvm.org/D99668
* [RISCV][Clang] Add RVV Widening Integer Add/Subtract intrinsic functions.Zakk Chen2021-04-115-1/+14170
| | | | | | | | | Reviewed By: craig.topper Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com> Co-Authored-by: Zakk Chen <zakk.chen@sifive.com> Differential Revision: https://reviews.llvm.org/D99526
* [libtooling][clang-tidy] Fix diagnostics not highlighting fed SourceRangesWhisperity2021-04-104-41/+40
| | | | | | | | | | | | | | | | | | Fixes bug http://bugs.llvm.org/show_bug.cgi?id=49000. This patch allows Clang-Tidy checks to do diag(X->getLocation(), "text") << Y->getSourceRange(); and get the highlight of `Y` as expected: warning: text [blah-blah] xxx(something) ^ ~~~~~~~~~ Reviewed-By: aaron.ballman, njames93 Differential Revision: http://reviews.llvm.org/D98635
* [Matrix] Implement C-style explicit type conversions for matrix types.Saurabh Jha2021-04-1018-13/+368
| | | | | | | | | | | This implements C-style type conversions for matrix types, as specified in clang/docs/MatrixTypes.rst. Fixes PR47141. Reviewed By: fhahn Differential Revision: https://reviews.llvm.org/D99037
* [RISCV][Clang] Add RVV vleff intrinsic functions.Hsiangkai Wang2021-04-103-0/+2406
| | | | | | Reviewed By: craig.topper, liaolucy, jrtc27, khchen Differential Revision: https://reviews.llvm.org/D99151
* Temporairly revert "[CGCall] Annotate `this` argument with alignment"Roman Lebedev2021-04-108-62/+56
| | | | | | | As per @jyknight, "It seems like there's a bug with vtable thunks getting the wrong information." See https://reviews.llvm.org/D99790#2680857, https://godbolt.org/z/MxhYMe1q7 This reverts commit 0aa0458f1429372038ca6a4edc7e94c96cd9a753.
* [clang][AVR] Support variable decorator '__flash'Ben Shi2021-04-105-5/+36
| | | | | | Reviewed By: Anastasia Differential Revision: https://reviews.llvm.org/D96853
* [OpenMP51][DOCS] Claimed masked construct and report current patch, NFC.cchen2021-04-091-1/+1
|
* [OpenMP51] Initial support for masked directive and filter clausecchen2021-04-0926-27/+490
| | | | | | | | | Adds basic parsing/sema/serialization support for the #pragma omp masked directive. Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D99995
* Handle alloc_size attribute on function pointersAlex Richardson2021-04-098-16/+253
| | | | | | | | | | | | | | | | | I have been trying to statically find and analyze all calls to heap allocation functions to determine how many of them use sizes known at compile time vs only at runtime. While doing so I saw that quite a few projects use replaceable function pointers for heap allocation and noticed that clang was not able to annotate functions pointers with alloc_size. I have changed the Sema checks to allow alloc_size on all function pointers and typedefs for function pointers now and added checks that these attributes are propagated to the LLVM IR correctly. With this patch we can also compute __builtin_object_size() for calls to allocation function pointers with the alloc_size attribute. Reviewed By: aaron.ballman, erik.pilkington Differential Revision: https://reviews.llvm.org/D55212
* [clang] tests: cleanup, update and add some new onesMatheus Izvekov2021-04-0916-186/+563
| | | | | | | | | | | | | | | | This reworks a small set of tests, as preparatory work for implementing P2266. * Run for more standard versions, including c++2b. * Normalize file names and run commands. * Adds some extra tests. New Coroutine tests taken from Aaron Puchert's D68845. Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> Reviewed By: thakis Differential Revision: https://reviews.llvm.org/D99225
* [HIP] Workaround ICE compiling SemaChecking.cpp with gcc 5Yaxun (Sam) Liu2021-04-091-5/+4
| | | | Change-Id: I6c6213bc6b90365bfb78636ce7fb0700a58807cf
* RISCVABIInfo::classifyArgumentType: Fix static analyzer warnings with ↵Soumi Manna2021-04-091-2/+2
| | | | | | uninitialized variables warnings - NFCI Differential Revision: https://reviews.llvm.org/D100172
* [AMDGPU] Allow relaxed/consume memory order for atomic inc/decYaxun (Sam) Liu2021-04-094-20/+46
| | | | | | Reviewed by: Jon Chesterfield Differential Revision: https://reviews.llvm.org/D100144
* [clang] Tiny format fixNathan Sidwell2021-04-091-1/+1
| | | | | | Misindented close brace. Differential Revision: https://reviews.llvm.org/D100129
* [OpenCL] Simplify InsertOCLBuiltinDeclarationsFromTableSven van Haastregt2021-04-091-16/+12
| | | | | | | | - Use a range-based for loop. This will help a later patch to skip prototypes that use an unavailable return type or argument type. - Replace a dyn_cast with a cast, as we are only dealing with FunctionProtoType Types here.
* [clang][SourceManager] Fix -Wparentheses warning (NFC)Yang Fan2021-04-091-2/+2
| | | | | | | | | | | | | GCC warning: ``` /llvm-project/clang/lib/Basic/SourceManager.cpp: In instantiation of ‘constexpr T likelyhasbetween(T, unsigned char, unsigned char) [with T = long unsigned int]’: /llvm-project/clang/lib/Basic/SourceManager.cpp:1292:52: required from here /llvm-project/clang/lib/Basic/SourceManager.cpp:1264:48: warning: suggest parentheses around ‘+’ in operand of ‘&’ [-Wparentheses] 1264 | (x & ~static_cast<T>(0) / 255 * 127) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ 1265 | (~static_cast<T>(0) / 255 * (127 - (m - 1)))) & | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
* DebugInfo: Include inline namespaces in template specialization parameter namesDavid Blaikie2021-04-082-0/+9
| | | | | | | This ensures these types have distinct names if they are distinct types (eg: if one is an instantiation with a type in one inline namespace, and another from a type with the same simple name, but in a different inline namespace).
* [ASTMatchers] Add `cxxBaseSpecifier` matcher (non-top-level)Nikita Kniazev2021-04-097-9/+114
| | | | | | | | | Required for capturing base specifier in matchers: `cxxRecordDecl(hasDirectBase(cxxBaseSpecifier().bind("base")))` Reviewed By: steveire, aaron.ballman Differential Revision: https://reviews.llvm.org/D69218
* Include `count` in AppleClang toolchains.Dan Liew2021-04-081-0/+1
| | | | | | | | | | | | | The motivation here is so we can run the compiler-rt tests from a standalone build against AppleClang. In particular the `Posix/halt_on_error-torture.cpp` and `Posix/halt_on_error_suppress_equal_pcs.cpp` ASan test cases currently require this binary for the tests to pass. rdar://76366784 Differential Revision: https://reviews.llvm.org/D100087
* [AMDGPU] Allow -amdgpu-unsafe-fp-atomics to ignore denorm modeStanislav Mekhanoshin2021-04-081-0/+4
| | | | | | Fixes: SWDEV-274276 Differential Revision: https://reviews.llvm.org/D100072
* [AIX] Support init priority attributeXiangling Liao2021-04-086-48/+167
| | | | Differential Revision: https://reviews.llvm.org/D99291
* [RISCV] Prevent __builtin_riscv_orc_b_64 from being compiled RV32 target.Craig Topper2021-04-085-5/+33
| | | | | | | | | | | | | | | | | | The backend can't handle this and will throw a fatal error from type legalization. It's easy enough to fix that for this intrinsic by just splitting the IR intrinsic since it works on individual bytes. There will be other intrinsics in the future that would be harder to support through splitting, for example grev, gorc, and shfl. Those would require a compare and a select be inserted to check the MSB of their control input. This patch adds support for preventing this in the frontend with a nice diagnostic. Reviewed By: frasercrmck Differential Revision: https://reviews.llvm.org/D99984
* [analyzer] Fix false positives in inner pointer checker (PR49628)Valeriy Savchenko2021-04-082-26/+84
| | | | | | | | This patch supports std::data and std::addressof functions. rdar://73463300 Differential Revision: https://reviews.llvm.org/D99260
* [analyzer] Fix crash on spaceship operator (PR47511)Valeriy Savchenko2021-04-082-0/+27
| | | | | | rdar://68954187 Differential Revision: https://reviews.llvm.org/D99181
* Revert "Reduce the number of attributes attached to each function"Dávid Bolvanský2021-04-087-6770/+6083
| | | | This reverts commit 053dc95839b3b8a36db46f8c419e36e632e989cd. It causes perf regressions - see discussion in D97116.
* [NFC] Fix warning introduced in 20105b6b4874a85813f7a4a3d8ad2a0f023dda14serge-sans-paille2021-04-081-1/+1
|
* [analyzer] Fix dead store checker false positiveValeriy Savchenko2021-04-082-4/+71
| | | | | | | | | | It is common to zero-initialize not only scalar variables, but also structs. This is also defensive programming and we shouldn't complain about that. rdar://34122265 Differential Revision: https://reviews.llvm.org/D99262
* [OpenCL][Docs] Fix typo in section labelAnastasia Stulova2021-04-081-1/+1
|
* [flang][driver] Add debug options not requiring semantic checksAndrzej Warzynski2021-04-081-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds two debugging options in the new Flang driver (flang-new): *fdebug-unparse-no-sema *fdebug-dump-parse-tree-no-sema Each of these options combines two options from the "throwaway" driver (left: f18, right: flang-new): * `-fdebug-uparse -fdebug-no-semantics` --> `-fdebug-unparse-no-sema` * `-fdebug-dump-parse-tree -fdebug-no-semantics` --> `-fdebug-dump-parse-tree-no-sema` There are no plans to implement `-fdebug-no-semantics` in the new driver. Such option would be too powerful. Also, it would only make sense when combined with specific frontend actions (`-fdebug-unparse` and `-fdebug-dump-parse-tree`). Instead, this patch adds 2 specialised options listed above. Each of these is implemented through a dedicated FrontendAction (also added). The new frontend actions are implemented in terms of a new abstract base action: `PrescanAndSemaAction`. This new base class was required so that we can have finer control over what steps within the frontend are executed: * `PrescanAction`: run the _prescanner_ * `PrescanAndSemaAction`: run the _prescanner_ and the _parser_ (new in this patch) * `PrescanAndSemaAction`: run the _prescanner_, _parser_ and run the _semantic checks_ This patch introduces `PrescanAndParseAction::BeginSourceFileAction`. Apart from the semantic checks removed at the end, it is similar to `PrescanAndSemaAction::BeginSourceFileAction`. Differential Revision: https://reviews.llvm.org/D99645
* [OpenCL] Fix mipmap read_image return typesSven van Haastregt2021-04-081-4/+4
| | | | The return type did not match the function name.
* [clang] Speedup line offset mapping computationserge-sans-paille2021-04-081-11/+55
| | | | | | | | | | | | | | | | | Clang spends a decent amount of time in the LineOffsetMapping::get(...) function. This function used to be vectorized (through SSE2) then the optimization got dropped because the sequential version was on-par performance wise. This provides an optimization of the sequential version that works on a word at a time, using (documented) bithacks to provide a portable vectorization. When preprocessing the sqlite amalgamation, this yields a sweet 3% speedup. This is a recommit of 6951b72334bbe4c189c71751edc1e361d7b5632c with endianness and unsigned long vs uint64_t issues fixed (hopefully). Differential Revision: https://reviews.llvm.org/D99409
* Include `llvm-config` and `not` in AppleClang toolchains.Dan Liew2021-04-071-0/+2
| | | | | | | | | The motivation here is so that we can configure and run compiler-rt tests from a standalone build against AppleClang. rdar://75975846 Differential Revision: https://reviews.llvm.org/D100086
* [Driver] Drop $DEFAULT_TRIPLE-$name as a fallback program nameFangrui Song2021-04-072-11/+3
| | | | | | | | | | | | D13340 introduced this behavior which is not needed even for mips. This was raised on https://lists.llvm.org/pipermail/cfe-dev/2020-May/065437.html but no action was taken. This was raised again in https://lists.llvm.org/pipermail/cfe-dev/2021-April/067974.html "The LLVM host/target TRIPLE padding drama on Debian" as it caused confusion. This patch drops the behavior. Differential Revision: https://reviews.llvm.org/D99996
* [RISCV] Use multiclass inheritance to simplify some of riscv_vector.td. NFCICraig Topper2021-04-071-105/+87
| | | | | | | | | We don't need to instantiate single multiclasses inside of other multiclasses. We can use inheritance and save writing 'defm ""'. Reviewed By: khchen Differential Revision: https://reviews.llvm.org/D100074
* [Driver][test] Test intended target onlyJinsong Ji2021-04-071-1/+1
| | | | | | | | | | | | | | 6fe7de90b9e4e466a5c2baadafd5f72d3203651d changed GNU toolchain, and added new RUN line to test expected behavior. The change is for GNU toolchain only, so this will fail other toolchain, eg: AIX. Update the test with `-target` to test GNU tool chain only. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D99901