summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "builtins: relax __iso_volatile_{load,store}32"Saleem Abdulrasool2019-06-231-17/+0
| | | | | | | This reverts commit SVN r364137. This seems to be cause problems with casting in C. llvm-svn: 364147
* Fix TBAA representation for zero-sized fields and unnamed bit-fields.Richard Smith2019-06-221-0/+16
| | | | | | | | | | | | | | | Unnamed bit-fields should not be represented in the TBAA metadata because they do not represent storage fields (they only affect layout). Zero-sized fields should not be represented in the TBAA metadata because by definition they have no associated storage (so we will never emit a load or store through them), and they might not appear in declaration order within the struct layout. Fixes a verifier failure when emitting a TBAA-enabled load through a class type containing a zero-sized field. llvm-svn: 364140
* builtins: relax __iso_volatile_{load,store}32Saleem Abdulrasool2019-06-221-0/+17
| | | | | | | | | | | This is reduced from MSVC's MSVCPRT 14.21.27702 atomic header. Because Windows is a LLP64 environment, `long`, `long int`, and `int` are all synonymous. Change the signature for `__iso_volatile_load32` and `__iso_volatile_store32` to accept a `long int` instead. This allows an implicit cast of `int` to `long int` while also permitting `long` to be accepted. llvm-svn: 364137
* Remove binary finally accidentially committed in r364109Erich Keane2019-06-211-0/+0
| | | | llvm-svn: 364110
* Ensure Target Features always_inline error happens in C++ cases.Erich Keane2019-06-212-0/+17
| | | | | | | | A handful of C++ cases as reported in PR42352 didn't actually give an error when always_inlining with a different target feature list. This resulted in broken IR. llvm-svn: 364109
* Devirtualize destructor of final class.Hiroshi Yamauchi2019-06-211-0/+23
| | | | | | | | | | | | | | | | | | | Summary: Take advantage of the final keyword to devirtualize destructor calls. Fix https://bugs.llvm.org/show_bug.cgi?id=21368 Reviewers: rsmith Reviewed By: rsmith Subscribers: davidxl, Prazek, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63161 llvm-svn: 364100
* Fix ARM buildbot.Richard Smith2019-06-211-4/+4
| | | | llvm-svn: 364081
* [clang][NewPM] Add -fno-experimental-new-pass-manager to testsLeonard Chan2019-06-213-15/+46
| | | | | | | | | | | | | | | | As per the discussion on D58375, we disable test that have optimizations under the new PM. This patch adds -fno-experimental-new-pass-manager to RUNS that: - Already run with optimizations (-O1 or higher) that were missed in D58375. - Explicitly test new PM behavior along side some new PM RUNS, but are missing this flag if new PM is enabled by default. - Specify -O without the number. Based on getOptimizationLevel(), it seems the default is 2, and the IR appears to be the same when changed to -O2, so update the test to explicitly say -O2 and provide -fno-experimental-new-pass-manager`. Differential Revision: https://reviews.llvm.org/D63156 llvm-svn: 364066
* [CodeGen][test] Use FileCheck variable matchers for better test supportJordan Rupprecht2019-06-201-5/+12
| | | | | | | | | | | | | | | | Summary: Depending on how clang is built, it may discard the IR names and use names like `%2` instead of `%result.ptr`, causing tests that rely on the IR name to fail. Using FileCheck matchers makes the test work regardless of how clang is built. This test passes with both `-fno-discard-value-names` and `-fdiscard-value-names` to make sure it passes regardless of the build mode. Reviewers: rnk, akhuang, aprantl, lebedev.ri Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63625 llvm-svn: 363996
* P0840R2: support for [[no_unique_address]] attributeRichard Smith2019-06-202-0/+123
| | | | | | | | | | | | | | | | | Summary: Add support for the C++2a [[no_unique_address]] attribute for targets using the Itanium C++ ABI. This depends on D63371. Reviewers: rjmccall, aaron.ballman Subscribers: dschuff, aheejin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63451 llvm-svn: 363976
* Store a pointer to the return value in a static alloca and let the debugger ↵Amy Huang2019-06-203-5/+32
| | | | | | | | | | | | | | use that as the variable address for NRVO variables. Subscribers: hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D63361 llvm-svn: 363952
* [Sema] Diagnose addr space mismatch while constructing objectsAnastasia Stulova2019-06-201-1/+4
| | | | | | | | | | | | | | If we construct an object in some arbitrary non-default addr space it should fail unless either: - There is an implicit conversion from the address space to default /generic address space. - There is a matching ctor qualified with an address space that is either exactly matching or convertible to the address space of an object. Differential Revision: https://reviews.llvm.org/D62156 llvm-svn: 363944
* [clang][NewPM] Fixing remaining -O0 tests that are broken under new PMLeonard Chan2019-06-191-0/+4
| | | | | | | | | | | | | | - CodeGen/flatten.c will fail under new PM becausec the new PM AlwaysInliner seems to intentionally inline functions but not call sites marked with alwaysinline (D23299) - Tests that check remarks happen to check them for the inliner which is not turned on at O0. These tests just check that remarks work, but we can make separate tests for the new PM with -O1 so we can turn on the inliner and check the remarks with minimal changes. Differential Revision: https://reviews.llvm.org/D62225 llvm-svn: 363846
* [NFC][codeview] Avoid undefined grep in debug-info-codeview-display-name.cppHubert Tong2019-06-191-1/+1
| | | | | | | | | vertical-line is not a BRE special character. POSIX.1-2017 XBD Section 9.3.2 indicates that the interpretation of `\|` is undefined. This patch uses an ERE instead. llvm-svn: 363826
* Rewrite ConstStructBuilder with a mechanism that can cope with splitting and ↵Richard Smith2019-06-171-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | updating constants. Summary: This adds a ConstantBuilder class that deals with incrementally building an aggregate constant, including support for overwriting previously-emitted parts of the aggregate with new values. This fixes a bunch of cases where we used to be unable to reduce a DesignatedInitUpdateExpr down to an IR constant, and also lays some groundwork for emission of class constants with [[no_unique_address]] members. Reviewers: rjmccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63371 llvm-svn: 363620
* PR42205: DebugInfio: Do not attempt to emit debug info metadata for static ↵David Blaikie2019-06-171-0/+13
| | | | | | | | | | | member variable template partial specializations Would cause a crash in an attempt to create the type for the still unresolved 'auto' in the partial specialization (& even without the use of 'auto', the expression would be value dependent & crash/assertion-fail there). llvm-svn: 363606
* Re-commit r357452 (take 3): "SimplifyCFG SinkCommonCodeFromPredecessors: ↵Hans Wennborg2019-06-172-2/+1
| | | | | | | | | | | Also sink function calls without used results (PR41259)" Third time's the charm. This was reverted in r363220 due to being suspected of an internal benchmark regression and a test failure, none of which turned out to be caused by this. llvm-svn: 363529
* [CodeGen][ObjC] Annotate retain-agnostic ObjC globals with attributeAkira Hatanaka2019-06-141-1/+1
| | | | | | | | | | | | | | | 'objc_arc_inert' The attribute enables the ARC optimizer to delete ObjC ARC runtime calls on the annotated globals (see https://reviews.llvm.org/D62433). We currently only annotate global variables for string literals and global blocks with the attribute. rdar://problem/49839633 Differential Revision: https://reviews.llvm.org/D62831 llvm-svn: 363467
* PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of typeRichard Smith2019-06-141-0/+47
| | | | | | | | | | | nullptr_t does not access memory. We now reuse CK_NullToPointer to represent a conversion from a glvalue of type nullptr_t to a prvalue of nullptr_t where necessary. This reinstates r363337, reverted in r363352. llvm-svn: 363429
* C++ DR712 and others: handle non-odr-use resulting from an lvalue-to-rvalue ↵Richard Smith2019-06-141-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | conversion applied to a member access or similar not-quite-trivial lvalue expression. Summary: When a variable is named in a context where we can't directly emit a reference to it (because we don't know for sure that it's going to be defined, or it's from an enclosing function and not captured, or the reference might not "work" for some reason), we emit a copy of the variable as a global and use that for the known-to-be-read-only access. This reinstates r363295, reverted in r363352, with a fix for PR42276: we now produce a proper name for a non-odr-use reference to a static constexpr data member. The name <mangled-name>.const is used in that case; such names are reserved to the implementation for cases such as this and should demangle nicely. Reviewers: rjmccall Subscribers: jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63157 llvm-svn: 363428
* Revert 363295, it caused PR42276. Also revert follow-ups 363337, 363340.Nico Weber2019-06-142-74/+0
| | | | | | | | Revert 363340 "Remove unused SK_LValueToRValue initialization step." Revert 363337 "PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type" Revert 363295 "C++ DR712 and others: handle non-odr-use resulting from an lvalue-to-rvalue conversion applied to a member access or similar not-quite-trivial lvalue expression." llvm-svn: 363352
* PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of typeRichard Smith2019-06-131-0/+47
| | | | | | | | | | | | nullptr_t does not access memory. We now reuse CK_NullToPointer to represent a conversion from a glvalue of type nullptr_t to a prvalue of nullptr_t where necessary. This reinstates r345562, reverted in r346065, now that CodeGen's handling of non-odr-used variables has been fixed. llvm-svn: 363337
* C++ DR712 and others: handle non-odr-use resulting from an lvalue-to-rvalue ↵Richard Smith2019-06-131-0/+27
| | | | | | | | | | | | | | | | | | | | | conversion applied to a member access or similar not-quite-trivial lvalue expression. Summary: When a variable is named in a context where we can't directly emit a reference to it (because we don't know for sure that it's going to be defined, or it's from an enclosing function and not captured, or the reference might not "work" for some reason), we emit a copy of the variable as a global and use that for the known-to-be-read-only access. Reviewers: rjmccall Subscribers: jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63157 llvm-svn: 363295
* PR42182: Allow thread-local to use __cxa_thread_atexit whenErich Keane2019-06-131-0/+6
| | | | | | | | | | | -fno-use-cxx-atexit is used This matches the GCC behavior, __cxa_thread_atexit should be permissible even though cxa_atexit is disabled. Differential Revision: https://reviews.llvm.org/D63283/ llvm-svn: 363288
* Revert r361811: 'Re-commit r357452 (take 2): "SimplifyCFG ↵David L. Jones2019-06-132-1/+2
| | | | | | | | | | | | | | | | SinkCommonCodeFromPredecessors ...' We have observed some failures with internal builds with this revision. - Performance regressions: - llvm's SingleSource/Misc evalloop shows performance regressions (although these may be red herrings). - Benchmarks for Abseil's SwissTable. - Correctness: - Failures for particular libicu tests when building the Google AppEngine SDK (for PHP). hwennborg has already been notified, and is aware of reproducer failures. llvm-svn: 363220
* [MS] Pretend constexpr variable template specializations are inlineReid Kleckner2019-06-121-0/+11
| | | | | | | | | | | | | | | | | | | Fixes link errors with clang and the latest Visual C++ 14.21.27702 headers, which was reported as PR42027. I chose to intentionally make these things linkonce_odr, i.e. discardable, so that we don't emit definitions of these things in every translation unit that includes STL headers. Note that this is *not* what MSVC does: MSVC has not yet implemented C++ DR2387, so they emit fully specialized constexpr variable templates with static / internal linkage. Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D63175 llvm-svn: 363191
* PR42220: take into account the possibility of aggregates with baseRichard Smith2019-06-121-0/+18
| | | | | | classes when checking an InitListExpr for lifetime extension. llvm-svn: 363188
* DebugInfo: Add support for 'nodebug' attribute on typedefs and alias templatesDavid Blaikie2019-06-081-2/+14
| | | | | | | | | Seems like a logical extension to me - and of interest because it might help reduce the debug info size of libc++ by applying this attribute to type traits that have a disproportionate debug info cost compared to the benefit (& possibly harm/confusion) they cause users. llvm-svn: 362856
* Driver, IRGen: Set partitions on GlobalValues according to ↵Peter Collingbourne2019-06-071-0/+21
| | | | | | | | -fsymbol-partition flag. Differential Revision: https://reviews.llvm.org/D62636 llvm-svn: 362829
* LLVM IR: Generate new-style byval-with-Type from ClangTim Northover2019-06-0512-40/+40
| | | | | | | | | | | LLVM IR recently added a Type parameter to the byval Attribute, so that when pointers become opaque and no longer have an element type the information will still be present in IR. For now the Type parameter is optional (which is why Clang didn't need this change at the time), but it will become mandatory soon. llvm-svn: 362652
* [Clang] Disable new PM for tests that use optimization level -O1, -O2 and -O3Petr Hosek2019-06-0511-17/+17
| | | | | | | | | | Tests that use -O1, -O2 and -O3 would often produce different results with the new pass manager which makes these tests fail. Disable new PM explicitly for these tests. Differential Revision: https://reviews.llvm.org/D58375 llvm-svn: 362580
* PR42111: Use guarded initialization for thread-local variables withRichard Smith2019-06-051-0/+17
| | | | | | | | | unordered initialization and internal linkage. We'll run their initializers once on each reference, so we need a guard variable even though they only have a single definition. llvm-svn: 362562
* msabi: Fix exponential mangling time for even more contrived inputsNico Weber2019-06-041-0/+22
| | | | | | | | | | | | | | | This is a follow-up to r362293 which fixed exponential time needed for mangling certain templates. This fixes the same issue if that template pattern happens in template arguments > 10: The first ten template arguments can use back references, and r362293 added caching for back references. For latter arguments, we have to add a cache for the mangling itself instead. Fixes PR42091 even more. Differential Revision: https://reviews.llvm.org/D62780 llvm-svn: 362560
* Add mangling test coverage for non-volatile const member pointersNico Weber2019-06-021-0/+4
| | | | llvm-svn: 362331
* Add test coverage for __pascal manglingNico Weber2019-06-021-0/+4
| | | | llvm-svn: 362329
* msabi: Fix exponential mangling time for certain pathological inputsNico Weber2019-06-011-0/+41
| | | | | | | | | | | | | | | | | Template back references used to be recursively recomputed, add a memoization cache to cut down on this. Since there are now two different types of argument maps, rename the existing TypeBackReferences to FunArgBackReferences, and rename mangleArgumentType() to mangleFunctionArgumentType(). Fixes PR42091, the input there now takes 50ms instead of 7s to compile. No intended behavior change. Differential Revision: https://reviews.llvm.org/D62746 llvm-svn: 362293
* Add enums as global variables in the IR metadata.Amy Huang2019-05-301-0/+14
| | | | | | | | | | | | | | | | Summary: Keeps track of the enums that were used by saving them as DIGlobalVariables, since CodeView emits debug info for global constants. Reviewers: rnk Subscribers: aprantl, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D62635 llvm-svn: 362166
* Reapply: LLVM IR: update Clang tests for byval being a typed attribute.Tim Northover2019-05-303-5/+5
| | | | | | | | | | Since byval is now a typed attribute it gets sorted slightly differently by LLVM when the order of attributes is being canonicalized. This updates the few Clang tests that depend on the old order. Clang patch is unchanged. llvm-svn: 362129
* CodeView - add static data members to global variable debug info.Amy Huang2019-05-291-1/+12
| | | | | | | | | | | | | | | | | | Summary: Add static data members to IR debug info's list of global variables so that they are emitted as S_CONSTANT records. Related to https://bugs.llvm.org/show_bug.cgi?id=41615. Reviewers: rnk Subscribers: aprantl, cfe-commits, llvm-commits, thakis Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D62167 llvm-svn: 362038
* Revert "LLVM IR: update Clang tests for byval being a typed attribute."Tim Northover2019-05-293-5/+5
| | | | | | The underlying LLVM change couldn't cope with llvm-link and broke LTO builds. llvm-svn: 362028
* LLVM IR: update Clang tests for byval being a typed attribute.Tim Northover2019-05-293-5/+5
| | | | | | | | Since byval is now a typed attribute it gets sorted slightly differently by LLVM when the order of attributes is being canonicalized. This updates the few Clang tests that depend on the old order. llvm-svn: 362013
* [WebAssembly] Support VPtr sanitizer for EmscriptenThomas Lively2019-05-291-0/+20
| | | | | | | | | | | | | | | | | | | | | | | Summary: After https://github.com/emscripten-core/emscripten/pull/8651, Emscripten supports the full UBSan runtime. This includes the VPtr sanitizer. This diff allows clang to generate code that uses the VPtr sanitizer for Emscripten. Patch by Guanzhong Chen Reviewers: tlively, aheejin Reviewed By: aheejin Subscribers: dschuff, sbc100, jgravelle-google, sunfish, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62559 llvm-svn: 362004
* clang-cl: Fix mangling of catchable types with names longer than 4kiBNico Weber2019-05-291-0/+15
| | | | | | | | | | | | | | | The mangling used to contain the MD5 name of both the RTTI type descriptor and the name of the copy ctor in MSVC2013, but it changed to just the former in 2015. It looks like it changed back to the old mangling in VS2017 version 15.7 and onwards, including VS2019 (version 16.0). VS2017 version 15.0 still has the VS2015 mangling. Versions between 15.0 and 15.7 are't on godbolt. I found 15.4 (_MSC_VER 1911) locally and that uses the 15.0 mangling still, but I didn't find 15.5 or 15.6, so I'm not sure where exactly it changed back. Differential Revision: https://reviews.llvm.org/D62490 llvm-svn: 361959
* Make __has_builtin work with __builtin_LINE and friends.Eric Fiselier2019-05-291-4/+4
| | | | | | | | | | The source location builtins are implemented as keywords, but __has_builtin should still report true for them. This patch also fixes a test failure on systemz where the alignment of string literals is 2 not 1. llvm-svn: 361920
* Re-commit r357452 (take 2): "SimplifyCFG SinkCommonCodeFromPredecessors: ↵Hans Wennborg2019-05-282-2/+1
| | | | | | | | | | | | | | | | | | | | Also sink function calls without used results (PR41259)" This was reverted in r360086 as it was supected of causing mysterious test failures internally. However, it was never concluded that this patch was the root cause. > The code was previously checking that candidates for sinking had exactly > one use or were a store instruction (which can't have uses). This meant > we could sink call instructions only if they had a use. > > That limitation seemed a bit arbitrary, so this patch changes it to > "instruction has zero or one use" which seems more natural and removes > the need to special-case stores. > > Differential revision: https://reviews.llvm.org/D59936 llvm-svn: 361811
* Permit static local structured bindings to be named from arbitrary scopes ↵Richard Smith2019-05-251-1/+11
| | | | | | inside their declaring scope. llvm-svn: 361686
* Ensure builtins use the target default Calling ConventionErich Keane2019-05-231-0/+11
| | | | | | | | | | | | | | | | | r355317 changed builtins/allocation functions to use the default calling convention in order to support platforms that use non-cdecl calling conventions by default. However the default calling convention is overridable on Windows 32 bit implementations with some of the /G options. The intent is to permit the user to set the calling convention of normal functions, however it should NOT apply to builtins and C++ allocation functions. This patch ensures that the builtin/allocation functions always use the Target specific Calling Convention, ignoring the user overridden version of said default. llvm-svn: 361507
* Part of P1091R3: permit structured bindings to be declared 'static' andRichard Smith2019-05-221-0/+47
| | | | | | 'thread_local' in C++20. llvm-svn: 361424
* Remove unneeded alignment spec from builtin_FUNCTION.cpp testEric Fiselier2019-05-161-2/+2
| | | | llvm-svn: 360951
* Fix failing source location test on WindowsEric Fiselier2019-05-161-5/+5
| | | | llvm-svn: 360947
OpenPOWER on IntegriCloud