summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Update NRVO logic to support early returnTaiju Tsuiki2018-05-306-51/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The previous implementation misses an opportunity to apply NRVO (Named Return Value Optimization) below. That discourages user to write early return code. ``` struct Foo {}; Foo f(bool b) { if (b) return Foo(); Foo oo; return oo; } ``` That is, we can/should apply RVO for a local variable if: * It's directly returned by at least one return statement. * And, all reachable return statements in its scope returns the variable directly. While, the previous implementation disables the RVO in a scope if there are multiple return statements that refers different variables. On the new algorithm, local variables are in NRVO_Candidate state at first, and a return statement changes it to NRVO_Disabled for all visible variables but the return statement refers. Then, at the end of the function AST traversal, NRVO is enabled for variables in NRVO_Candidate state and refers from at least one return statement. Reviewers: rsmith Reviewed By: rsmith Subscribers: xbolva00, Quuxplusone, arthur.j.odwyer, cfe-commits Differential Revision: https://reviews.llvm.org/D47067 llvm-svn: 333500
* Sema: Add a flag for rejecting member pointers with incomplete base types.Peter Collingbourne2018-05-303-5/+17
| | | | | | | | | | Codebases that need to be compatible with the Microsoft ABI can pass this flag to avoid issues caused by the lack of a fixed ABI for incomplete member pointers. Differential Revision: https://reviews.llvm.org/D47503 llvm-svn: 333498
* [X86] Fix the names of a bunch of icelake intrinsics.Craig Topper2018-05-303-119/+108
| | | | | | | | Mostly this fixes the names of all the 128-bit intrinsics to start with _mm_ instead of _mm128_ as is the convention and what the Intel docs say. This also fixes the name of the bitshuffle intrinsics to say epi64 for 128 and 256 bit versions. llvm-svn: 333497
* Make the mangled name collision diagnostic a bit more useful by listing the ↵Richard Smith2018-05-301-5/+6
| | | | | | | | | | mangling. This helps especially when the collision is for a template specialization, where the template arguments are not available from anywhere else in the diagnostic, and are likely relevant to the problem. llvm-svn: 333489
* [ODRHash] Support FunctionTemplateDecl in records.Richard Trieu2018-05-302-1/+339
| | | | llvm-svn: 333486
* [Sema] Use %sub to cleanup overload diagnosticsEric Fiselier2018-05-301-105/+116
| | | | | | | | | | | | | | | | | | | | Summary: This patch adds the newly added `%sub` diagnostic modifier to cleanup repetition in the overload candidate diagnostics. I think this should be good to go. @rsmith: Some of the notes now emit `function template` where they only said `function` previously. It seems OK to me, but I would like your sign off on it. Reviewers: rsmith, EricWF Reviewed By: EricWF Subscribers: cfe-commits, rsmith Differential Revision: https://reviews.llvm.org/D47101 llvm-svn: 333485
* Add HIP toolchainYaxun Liu2018-05-304-15/+492
| | | | | | | | | | | | | | This patch adds HIP toolchain to support HIP language mode. It includes: Create specific compiler jobs for HIP. Choose specific libraries for HIP. With contribution from Greg Rodgers. Differential Revision: https://reviews.llvm.org/D45212 llvm-svn: 333484
* Add action builder for HIPYaxun Liu2018-05-301-114/+218
| | | | | | | | | | To support separate compile/link and linking across device IR in different source files, a new HIP action builder is introduced. Basically it compiles/links host and device code separately, and embed fat binary in host linking stage through linker script. Differential Revision: https://reviews.llvm.org/D46476 llvm-svn: 333483
* Revert r332839.Richard Smith2018-05-301-14/+4
| | | | | | | This is causing miscompiles and "definition with same mangled name as another definition" errors. llvm-svn: 333482
* Check pointer null-ness before dereferencing it.Richard Trieu2018-05-291-5/+6
| | | | | | | | -Warc-repeated-use-of-weak may trigger a segmentation fault when the Decl being checked is outside of a function scope, leaving the current function info pointer null. This adds a check before using the function info. llvm-svn: 333471
* [Driver] Rename DefaultTargetTriple to TargetTriplePetr Hosek2018-05-291-17/+17
| | | | | | | | | | | While this value is initialized with the DefaultTargetTriple, it can be later overriden using the -target flag so TargetTriple is a more accurate name. This change also provides an accessor which could be accessed from ToolChain implementations. Differential Revision: https://reviews.llvm.org/D47357 llvm-svn: 333468
* [CodeGen][Darwin] Set the calling-convention of thread-local variableAkira Hatanaka2018-05-291-1/+5
| | | | | | | | | | | | | | | initialization functions to 'cxx_fast_tlscc'. This fixes a bug where instructions calling initialization functions for thread-local static members of c++ template classes were using calling convention 'cxx_fast_tlscc' while the called functions weren't annotated with the calling convention. rdar://problem/40447463 Differential Revision: https://reviews.llvm.org/D47354 llvm-svn: 333447
* [analyzer] const init: handle non-explicit cases more accuratelyRafael Stahl2018-05-291-5/+18
| | | | | | | | | | | | | | Summary: If the access is out of bounds, return UndefinedVal. If it is missing an explicit init, return the implicit zero value it must have. Reviewers: NoQ, xazax.hun, george.karpenkov Reviewed By: NoQ Subscribers: szepet, rnkovacs, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D46823 llvm-svn: 333417
* Fix emission of phony dependency targets when adding extra depsDavid Stenberg2018-05-291-7/+15
| | | | | | | | | | | | | | | | | | | | | | | Summary: This commit fixes a bug where passing extra dependency entries (using -fdepfile-entry) would result in -MP incorrectly emitting a phony target for the input file, and no phony target for the first extra dependency. The extra dependencies are added first to the filename vector in DFGImpl. That clashed with the emission of the phony targets, as the code assumed that the first index always correspond to the input file. Reviewers: rsmith, pcc, krasin, bruno, vsapsai Reviewed By: vsapsai Subscribers: vsapsai, bruno, cfe-commits Differential Revision: https://reviews.llvm.org/D44568 llvm-svn: 333413
* Testing commit access with whitespace change.Rafael Stahl2018-05-291-2/+2
| | | | llvm-svn: 333396
* [X86] Merge the 3 different flavors of masked vpermi2var/vpermt2var builtins ↵Craig Topper2018-05-296-532/+350
| | | | | | to a single version without masking. Use select builtins with appropriate operand instead. llvm-svn: 333387
* [RISCV] Add -mrelax/-mno-relax flags to enable/disable RISCV linker relaxationShiva Chen2018-05-291-0/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D44888 llvm-svn: 333385
* [coroutines] Pass implicit object parameter to promise ctor (fix BUG37604)Gor Nishanov2018-05-281-0/+14
| | | | | | | | | | | | | | | | | | Summary: Complete the implementation of p0914r1. Implicit object parameter should be passed to a promise constructor. Fixes: https://bugs.llvm.org/show_bug.cgi?id=37604 Reviewers: modocache, rsmith, lewissbaker Reviewed By: modocache Subscribers: cfe-commits, EricWF Differential Revision: https://reviews.llvm.org/D47454 llvm-svn: 333379
* Revert r333347 "[X86] Rewrite the max and min reduction intrinsics to make ↵Craig Topper2018-05-261-118/+221
| | | | | | | | better use of other functions and to reduce width to 256 and 128 bits were possible." This wasn't supposed to be commited yet. llvm-svn: 333349
* [X86] Remove mask from avx512ifma builtins. Use a select instruction instead.Craig Topper2018-05-262-80/+52
| | | | | | This reduces from 12 builtins to 6 since we no longer need a mask and maskz version. llvm-svn: 333348
* [X86] Rewrite the max and min reduction intrinsics to make better use of ↵Craig Topper2018-05-261-221/+118
| | | | | | | | | | | | | | | | | | | other functions and to reduce width to 256 and 128 bits were possible. Summary: We only need to use 512 bit vectors all the way through v8i64 reductions since those max instructions are new to avx512f and only available in 512 bits until SKX. For v16i32 and floating point we have legacy 128/256 bit instructions we can use. I've tried to use other intrinsics to reduce the verbosity of the code and avoid having to mention all the shuffles. I've also removed all the -1 shuffle indices so the output sequence is fully specified and not left to backend optimization. Reviewers: RKSimon, spatel, GBuella Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D47401 llvm-svn: 333347
* Test commit; please ignore.George Burgess IV2018-05-261-1/+1
| | | | llvm-svn: 333333
* [analyzer] Add security checks for bcmp(), bcopy(), bzero().Artem Dergachev2018-05-261-0/+141
| | | | | | | | | | | These functions are obsolete. The analyzer would advice to replace them with memcmp(), memcpy() or memmove(), or memset(). Patch by Tom Rix! Differential Revision: https://reviews.llvm.org/D41881 llvm-svn: 333326
* Revert "[DebugInfo] Don't bother with MD5 checksums of preprocessed files."Paul Robinson2018-05-252-13/+4
| | | | | | | This reverts commit d734f2aa3f76fbf355ecd2bbe081d0c1f49867ab. Also known as r333311. A very small but nonzero number of bots fail. llvm-svn: 333319
* Support Swift calling convention for PPC64 targetsBob Wilson2018-05-252-2/+20
| | | | | | | This adds basic support for the Swift calling convention with PPC64 targets. Patch provided by Atul Sowani in bug report #37223 llvm-svn: 333316
* [DebugInfo] Don't bother with MD5 checksums of preprocessed files.Paul Robinson2018-05-252-4/+13
| | | | | | | | | | The checksum will not reflect the real source, so there's no clear reason to include them in the debug info. Also this was causing a crash on the DWARF side. Differential Revision: https://reviews.llvm.org/D47260 llvm-svn: 333311
* [Support] Avoid normalization in sys::getDefaultTargetTriplePetr Hosek2018-05-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | The return value of sys::getDefaultTargetTriple, which is derived from -DLLVM_DEFAULT_TRIPLE, is used to construct tool names, default target, and in the future also to control the search path directly; as such it should be used textually, without interpretation by LLVM. Normalization of this value may lead to unexpected results, for example if we configure LLVM with -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-linux-gnu, normalization will transform that value to x86_64--linux-gnu. Driver will use that value to search for tools prefixed with x86_64--linux-gnu- which may be confusing. This is also inconsistent with the behavior of the --target flag which is taken as-is without any normalization and overrides the value of LLVM_DEFAULT_TARGET_TRIPLE. Users of sys::getDefaultTargetTriple already perform their own normalization as needed, so this change shouldn't impact existing logic. Differential Revision: https://reviews.llvm.org/D47153 llvm-svn: 333307
* [OPENMP, NVPTX] Fixed codegen for orphaned parallel region.Alexey Bataev2018-05-251-25/+19
| | | | | | | | | | | | | | If orphaned parallel region is found, the next code must be emitted: ``` if(__kmpc_is_spmd_exec_mode() || __kmpc_parallel_level(loc, gtid)) Serialized execution. else if (IsMasterThread()) Prepare and signal worker. else Outined function call. ``` llvm-svn: 333301
* Follow-up fix for nonnull atomic non-member functionsJF Bastien2018-05-251-2/+2
| | | | | | | | Handling of the third parameter was only checking for *_n and not for the C11 variant, which means that cmpxchg of a 'desired' 0 value was erroneously warning. Handle C11 properly, and add extgensive tests for this as well as NULL pointers in a bunch of places. Fixes r333246 from D47229. llvm-svn: 333290
* [analyzer] Added template argument lists to the Pathdiagnostic outputKristof Umann2018-05-251-2/+50
| | | | | | | | | | | Because template parameter lists were not displayed in the plist output, it was difficult to decide in some cases whether a given checker found a true or a false positive. This patch aims to correct this. Differential Revision: https://reviews.llvm.org/D46933 llvm-svn: 333275
* Optionally add code completion results for arrow instead of dotIvan Donchevskii2018-05-255-87/+162
| | | | | | | | | | | | | Currently getting such completions requires source correction, reparsing and calling completion again. And if it shows no results and rollback is required then it costs one more reparse. With this change it's possible to get all results which can be later filtered to split changes which require correction. Differential Revision: https://reviews.llvm.org/D41537 llvm-svn: 333272
* [ASTImporter] Fix ClassTemplateSpecialization in wrong DCGabor Marton2018-05-251-2/+6
| | | | | | | | | | | | | | Summary: ClassTemplateSpecialization is put in the wrong DeclContex if implicitly instantiated. This patch fixes it. Reviewers: a.sidorin, r.stahl, xazax.hun Subscribers: rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D47058 llvm-svn: 333269
* [x86] invpcid intrinsicGabor Buella2018-05-257-0/+52
| | | | | | | | | | | | An intrinsic for an old instruction, as described in the Intel SDM. Reviewers: craig.topper, rnk Reviewed By: craig.topper, rnk Differential Revision: https://reviews.llvm.org/D47142 llvm-svn: 333256
* Make atomic non-member functions as nonnullJF Bastien2018-05-251-15/+31
| | | | | | | | | | | | | | | | | Summary: As a companion to libc++ patch https://reviews.llvm.org/D47225, mark builtin atomic non-member functions which accept pointers as nonnull. The atomic non-member functions accept pointers to std::atomic / std::atomic_flag as well as to the non-atomic value. These are all dereferenced unconditionally when lowered, and therefore will fault if null. It's a tiny gotcha for new users, especially when they pass in NULL as expected value (instead of passing a pointer to a NULL value). <rdar://problem/18473124> Reviewers: arphaman Subscribers: aheejin, cfe-commits Differential Revision: https://reviews.llvm.org/D47229 llvm-svn: 333246
* Improve diagonstic for braced-init-list as operand to ?: expression.Richard Smith2018-05-241-6/+22
| | | | llvm-svn: 333234
* Switch a couple of users of LangOpts::GNUMode to the more appropriate ↵Richard Smith2018-05-242-3/+3
| | | | | | LangOpts::GNUKeywords. llvm-svn: 333233
* Improve diagnostics for config mismatches with -fmodule-file.Richard Smith2018-05-241-3/+10
| | | | | | | | Unless the user uses -Wno-module-file-config-mismatch (or -Wno-error=...), allow the AST reader to produce errors describing the nature of the config mismatch. llvm-svn: 333220
* [X86] Fix a bad cast in _mm512_mask_abs_epi32 and _mm512_maskz_abs_epi32.Craig Topper2018-05-241-2/+2
| | | | llvm-svn: 333211
* [analyzer] Move RangeSet related declarations into the ↵Mikhail R. Gadelha2018-05-242-236/+256
| | | | | | | | | | | | | | | | | | RangedConstraintManager header. Summary: I could also move `RangedConstraintManager.h` under `include/` if you agree as it seems slightly out of place under `lib/`. Patch by Réka Kovács Reviewers: NoQ, george.karpenkov, dcoughlin, rnkovacs Reviewed By: NoQ Subscribers: mikhail.ramalho, whisperity, xazax.hun, baloghadamsoftware, szepet, a.sidorin, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D45920 llvm-svn: 333179
* [VFS] Implement getRealPath in InMemoryFileSystem.Eric Liu2018-05-241-0/+13
| | | | | | | | | | Reviewers: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D47262 llvm-svn: 333172
* [clang-format] Fix putting ObjC message arguments in one line for multiline ↵Jacek Olesiak2018-05-241-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | receiver Summary: Reapply reverted changes from D46879. Currently BreakBeforeParameter is set to true everytime message receiver spans multiple lines, e.g.: ``` [[object block:^{ return 42; }] aa:42 bb:42]; ``` will be formatted: ``` [[object block:^{ return 42; }] aa:42 bb:42]; ``` even though arguments could fit into one line. This change fixes this behavior. Test Plan: make -j12 FormatTests && tools/clang/unittests/Format/FormatTests Reviewers: benhamilton, krasimir Reviewed By: benhamilton, krasimir Subscribers: djasper, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D47195 llvm-svn: 333171
* [Sparc] Use the leon arch for Leon3's when using an external assemblerDaniel Cederman2018-05-241-4/+19
| | | | | | | | | | | | | | Summary: This allows the use of the casa instruction available in most Leon3's. Reviewers: jyknight Reviewed By: jyknight Subscribers: joerg, fedor.sergeev, jrtc27, cfe-commits Differential Revision: https://reviews.llvm.org/D47138 llvm-svn: 333157
* [Sema][ObjC] Do not DiagnoseUseOfDecl in LookupMemberExprSteven Wu2018-05-241-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Remove the call to DiagnoseUseOfDecl in LookupMemberExpr because: 1. LookupMemberExpr eagerly lookup both getter and setter, reguardless if they are used or not. It causes wrong diagnostics if you are only using getter. 2. LookupMemberExpr only diagnoses getter, but not setter. 3. ObjCPropertyOpBuilder already DiagnoseUseOfDecl when building getter and setter. Doing it again in LookupMemberExpr causes duplicated diagnostics. rdar://problem/38479756 Reviewers: erik.pilkington, arphaman, doug.gregor Reviewed By: arphaman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D47280 llvm-svn: 333148
* Use zeroinitializer for (trailing zero portion of) large array initializersRichard Smith2018-05-232-79/+94
| | | | | | | | more reliably. This re-commits r333044 with a fix for PR37560. llvm-svn: 333141
* Rework __builtin_classify_type support to better match GCC and to not assert onRichard Smith2018-05-231-80/+96
| | | | | | | | | | | | | | | | | | | | | | unusual types. Following the observed behavior of GCC, we now return -1 for vector types (along with all of our extensions that GCC doesn't support), and for atomic types we classify the underlying type. GCC appears to have changed its classification for function and array arguments between version 5 and version 6. Previously it would classify them as pointers in C and as functions or arrays in C++, but from version 6 onwards, it classifies them as pointers. We now follow the more recent GCC behavior rather than emulating what I can only assume to be a historical bug in their C++ support for this builtin. Finally, no version of GCC that I can find has ever used the "method" classification for C++ pointers to member functions. Instead, GCC classifies them as record types, presumably reflecting an internal implementation detail, but whatever the reason we now produce compatible results. llvm-svn: 333126
* [X86] Move the include of clzerointrin.h from immintrin.h back to x86intrin.h.Craig Topper2018-05-232-4/+5
| | | | | | This is an AMD intrinsic not an Intel intrinsic so it shouldn't be in immintrin.h llvm-svn: 333124
* [modules] Mark __wmmintrin_pclmul.h/__wmmintrin_aes.h as textualRaphael Isemann2018-05-231-8/+3
| | | | | | | | | | | | | | | | | | | | | | | Summary: Since clang r332929 these two headers throw errors when included from somewhere else than their wrapper header. It seems marking them as textual is the best way to fix the builds. Fixes this new module build error: While building module '_Builtin_intrinsics' imported from ...: In file included from <module-includes>:2: In file included from lib/clang/7.0.0/include/immintrin.h:54: In file included from lib/clang/7.0.0/include/wmmintrin.h:29: lib/clang/7.0.0/include/__wmmintrin_aes.h:25:2: error: "Never use <__wmmintrin_aes.h> directly; include <wmmintrin.h> instead." #error "Never use <__wmmintrin_aes.h> directly; include <wmmintrin.h> instead." Reviewers: rsmith, v.g.vassilev, craig.topper Reviewed By: craig.topper Subscribers: craig.topper, cfe-commits Differential Revision: https://reviews.llvm.org/D47277 llvm-svn: 333123
* [X86] Move all Intel defined intrinsic includes into immintrin.hCraig Topper2018-05-2311-66/+50
| | | | | | | | | | This matches the Intel documentation which shows them available by importing immintrin.h. x86intrin.h also includes immintrin.h so anyone including x86intrin.h will still get them. This is different than gcc, but I don't think we were a perfect match there already. I'm unclear what gcc's policy is about how they choose which to add things to. Differential Revision: https://reviews.llvm.org/D47182 llvm-svn: 333110
* [CUDA] Fixed the list of GPUs supported by CUDA-9.Artem Belevich2018-05-231-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D47268 llvm-svn: 333098
* [ASTImporter] Fix missing implict CXXRecordDecl in ↵Gabor Marton2018-05-231-2/+8
| | | | | | | | | | | | | | | | ClassTemplateSpecializationDecl Summary: Currently we do not import the implicit CXXRecordDecl of a ClassTemplateSpecializationDecl. This patch fixes it. Reviewers: a.sidorin, xazax.hun, r.stahl Subscribers: rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D47057 llvm-svn: 333086
OpenPOWER on IntegriCloud