summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix always_inline 'target' compatibility check code for LambdasErich Keane2019-08-281-1/+45
| | | | | | | | | The previous version of this used CurFuncDecl in CodeGenFunction, however this doesn't include lambdas. However, CurCodeDecl DOES. Switch the check to use CurCodeDecl so that the actual function being emitted gets checked, preventing an error in ISEL. llvm-svn: 370261
* Debug Info: Support for DW_AT_export_symbols for anonymous structsShafik Yaghmour2019-08-271-0/+11
| | | | | | | | | | | | | | | | | | | | This implements the DWARF 5 feature described in: http://dwarfstd.org/ShowIssue.php?issue=141212.1 To support recognizing anonymous structs: struct A { struct { // Anonymous struct int y; }; } a; This patch adds support in CGDebugInfo::CreateLimitedType(...) for this new flag and an accompanying test to verify this feature. Differential Revision: https://reviews.llvm.org/D66667 llvm-svn: 370107
* Move EH spec mismatches under -fms-compatibilityReid Kleckner2019-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | | -fms-extensions is intended to enable conforming language extensions and -fms-compatibility is intended to language rule relaxations, so a user could plausibly compile with -fno-ms-compatibility on Windows while still using dllexport, for example. This exception specification validation behavior has been handled as a warning since before -fms-compatibility was added in 2011. I think it's just an oversight that it hasn't been moved yet. This will help users find conformance issues in their code such as those found in _com_ptr_t as described in https://llvm.org/PR42842. Reviewers: hans Subscribers: STL_MSFT, cfe-commits Differential Revision: https://reviews.llvm.org/D66770 llvm-svn: 370087
* Speculatively fix the build bots after r370052.Aaron Ballman2019-08-271-4/+4
| | | | llvm-svn: 370058
* Implement codegen for MSVC unions with reference members.Aaron Ballman2019-08-271-0/+34
| | | | | | | | Currently, clang accepts a union with a reference member when given the -fms-extensions flag. This change fixes the codegen for this case. Patch by Dominic Ferreira. llvm-svn: 370052
* NFC: Make test work with or without assertionsVitaly Buka2019-08-271-7/+10
| | | | llvm-svn: 369992
* hwasan, codegen: Keep more lifetime markers used for hwasanVitaly Buka2019-08-261-0/+3
| | | | | | | | | | | | Reviewers: eugenis Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66697 llvm-svn: 369980
* msan, codegen, instcombine: Keep more lifetime markers used for msanVitaly Buka2019-08-261-0/+3
| | | | | | | | | | | | Reviewers: eugenis Subscribers: hiraditya, cfe-commits, #sanitizers, llvm-commits Tags: #clang, #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D66695 llvm-svn: 369979
* Revert r369843 "[Testing] Unbreak r369830"Vitaly Buka2019-08-261-1/+0
| | | | | | | | That was not the fix. This reverts commit 8bcf690ae03db85608b2ea22eac7a91c84df4dc. llvm-svn: 369971
* [DebugInfo] Add debug-entry-values test coverage, NFCVedant Kumar2019-08-261-0/+7
| | | | | | | Check that call site descriptions are emitted in dwarf4 + lldb + debug-entry-values mode. llvm-svn: 369964
* [Testing] Unbreak r369830David Zarzycki2019-08-241-0/+1
| | | | llvm-svn: 369843
* NFC: Rename some sanitizer related lifetime checksVitaly Buka2019-08-242-42/+50
| | | | llvm-svn: 369830
* Revert r369458 "[DebugInfo] Add debug location to dynamic atexit destructor"Hans Wennborg2019-08-222-27/+7
| | | | | | | | | | | | | | | | It causes the build to fail with "inlinable function call in a function with debug info must have a !dbg location" in Chromium. See llvm-commits thread for more info. (This also reverts the follow-up in r369474.) > Fixes PR43012 > > Differential Revision: https://reviews.llvm.org/D66328 llvm-svn: 369633
* Add triple to new test to try to pacify botsReid Kleckner2019-08-201-1/+1
| | | | llvm-svn: 369474
* [DebugInfo] Add debug location to dynamic atexit destructorAlexandre Ganea2019-08-202-7/+27
| | | | | | | | Fixes PR43012 Differential Revision: https://reviews.llvm.org/D66328 llvm-svn: 369458
* [NewPM] Run ubsan-coroutines test under the legacy pass manager onlyLeonard Chan2019-08-201-1/+3
| | | | | | | | | | | The passes that lower the llvm.coro.* instrinsics have not yet been ported, so only run under the legacy PM for now. See https://bugs.llvm.org/show_bug.cgi?id=42867 Differential Revision: https://reviews.llvm.org/D66493 llvm-svn: 369442
* [Clang] Pragma vectorize_predicate implies vectorizeSjoerd Meijer2019-08-151-0/+41
| | | | | | | | | | New pragma "vectorize_predicate(enable)" now implies "vectorize(enable)", and it is ignored when vectorization is disabled with e.g. "vectorize(disable) vectorize_predicate(enable)". Differential Revision: https://reviews.llvm.org/D65776 llvm-svn: 368970
* [CodeGen] Disable UBSan for coroutine functionsBrian Gesiak2019-08-131-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As explained in http://lists.llvm.org/pipermail/llvm-dev/2018-March/121924.html, the LLVM coroutines transforms are not yet able to move the instructions for UBSan null checking past coroutine suspend boundaries. For now, disable all UBSan checks when generating code for coroutines functions. I also considered an approach where only '-fsanitize=null' would be disabled, However in practice this led to other LLVM errors when writing object files: "Cannot represent a difference across sections". For now, disable all UBSan checks until coroutine transforms are updated to handle them. Test Plan: 1. check-clang 2. Compile the program in https://gist.github.com/modocache/54a036c3bf9c06882fe85122e105d153 using the '-fsanitize=null' option and confirm it does not crash during LLVM IR generation. Reviewers: GorNishanov, vsk, eric_niebler, lewissbaker Reviewed By: vsk Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D44672 llvm-svn: 368675
* [NFC] Updated tests after r368657David Bolvansky2019-08-131-2/+2
| | | | llvm-svn: 368658
* Add SVE opaque built-in typesRichard Sandiford2019-08-093-0/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the SVE built-in types defined by the Procedure Call Standard for the Arm Architecture: https://developer.arm.com/docs/100986/0000 It handles the types in all relevant places that deal with built-in types. At the moment, some of these places bail out with an error, including: (1) trying to generate LLVM IR for the types (2) trying to generate debug info for the types (3) trying to mangle the types using the Microsoft C++ ABI (4) trying to @encode the types in Objective C (1) and (2) are fixed by follow-on patches but (unlike this patch) they deal mostly with target-specific LLVM details, so seemed like a logically separate change. There is currently no spec for (3) and (4), so reporting an error seems like the correct behaviour for now. The intention is that the types will become sizeless types: http://lists.llvm.org/pipermail/cfe-dev/2019-June/062523.html The main purpose of the sizeless type extension is to diagnose impossible or dangerous uses of the types, such as any that would require sizeof to have a meaningful defined value. Until then, the patch sets the alignments of the types to the values specified in the link above. It also sets the sizes of the types to zero, which is chosen to be consistently wrong and shouldn't affect correctly-written code (i.e. code that would compile even with the sizeless type extension). The patch adds the common subset of functionality needed to test the sizeless type extension on the one hand and to provide SVE intrinsic functions on the other. After this patch, the two pieces of work are essentially independent. The patch is based on one by Graham Hunter: https://reviews.llvm.org/D59245 Differential Revision: https://reviews.llvm.org/D62960 llvm-svn: 368413
* Recommit Devirtualize destructor of final class.Hiroshi Yamauchi2019-08-081-0/+23
| | | | | | | Original patch commited as r364100, reverted as r364359, recommitted as r365509, reverted as r365850. llvm-svn: 368323
* [ARM] Set default alignment to 64bitsDiogo N. Sampaio2019-08-081-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The maximum alignment used by ARM arch is 64bits, not 128. This could cause overaligned memory access for 128 bit neon vector that have unpredictable behaviour. This fixes: https://bugs.llvm.org/show_bug.cgi?id=42668 Reviewers: ostannard, dmgreen, srhines, danalbert, pirama, peter.smith Reviewed By: pirama, peter.smith Subscribers: phosek, thegameg, thakis, llvm-commits, carwil, peter.smith, javed.absar, kristof.beyls, cfe-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D65000 llvm-svn: 368288
* IR: print value numbers for unnamed function argumentsTim Northover2019-08-0334-214/+214
| | | | | | | | | | For consistency with normal instructions and clarity when reading IR, it's best to print the %0, %1, ... names of function arguments in definitions. Also modifies the parser to accept IR in that form for obvious reasons. llvm-svn: 367755
* Don't try emitting dllexported explicitly defaulted non-trivial ctors twice ↵Hans Wennborg2019-08-021-0/+7
| | | | | | | | | | during explicit template instantiation definition (PR42857) Trying to emit the definition twice triggers an assert. Differential revision: https://reviews.llvm.org/D65579 llvm-svn: 367661
* Delay emitting dllexport explicitly defaulted members until the class is ↵Hans Wennborg2019-08-011-0/+9
| | | | | | | | | | | | | | | | | | | | fully parsed (PR40006) This is similar to r245139, but that only addressed dllexported classes. It was still possible to run into the same problem with dllexported members in an otherwise normal class (see bug). This uses the same strategy to fix: delay defining the method until the whole class has been parsed. (The easiest way to see the ordering problem is in Parser::ParseCXXMemberSpecification(): it calls ParseLexedMemberInitializers() *after* ActOnFinishCXXMemberDecls(), which was trying to define the dllexport method. Now we delay it to ActOnFinishCXXNonNestedClass() which is called after both of those.) Differential revision: https://reviews.llvm.org/D65511 llvm-svn: 367520
* [DebugInfo] Don't emit incorrect descriptions of thunk params (PR42627)Vedant Kumar2019-07-291-0/+20
| | | | | | | | | | | | | | | | The `this` parameter of a thunk requires adjustment. Stop emitting an incorrect dbg.declare pointing to the unadjusted pointer. We could describe the adjusted value instead, but there may not be much benefit in doing so as users tend not to debug thunks. Robert O'Callahan reports that this matches gcc's behavior. Fixes PR42627. Differential Revision: https://reviews.llvm.org/D65035 llvm-svn: 367269
* Revert "Revert "CodeGen: ensure placeholder instruction for cleanup is created""Saleem Abdulrasool2019-07-251-0/+55
| | | | | | | | | This reverts commit fd1274fa78cb0fd32cc1fa2e6f5bb8e62d29df19. Add an explicit triple for the test which is pattern matching overly aggressively. llvm-svn: 367055
* Revert "CodeGen: ensure placeholder instruction for cleanup is created"JF Bastien2019-07-251-56/+0
| | | | | | | | | | | | | | | | | | | | | Originally in https://reviews.llvm.org/D64656 Causes bot failures: /home/buildslave/buildslave/clang-cmake-armv8-full/llvm/tools/clang/test/CodeGenCXX/pr40771-ctad-with-lambda-copy-capture.cpp:20:16: error: CHECK-NEXT: expected string not found in input // CHECK-NEXT: call void @_ZN1RC1E1Q(%struct.R* [[TMP_R]]) ^ <stdin>:37:2: note: scanning from here %8 = call %struct.R* @_ZN1RC1E1Q(%struct.R* %1) ^ <stdin>:37:2: note: with "TMP_R" equal to "%1" %8 = call %struct.R* @_ZN1RC1E1Q(%struct.R* %1) ^ <stdin>:37:17: note: possible intended match here %8 = call %struct.R* @_ZN1RC1E1Q(%struct.R* %1) ^ llvm-svn: 367051
* CodeGen: ensure placeholder instruction for cleanup is createdSaleem Abdulrasool2019-07-251-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A placeholder instruction for use in generation of cleanup code for an initializer list would not be emitted if the base class contained a non-trivial destructor and the class contains no fields of its own. This would be the case when using CTAD to deduce the template arguments for a struct with an overloaded call operator, e.g. ``` template <class... Ts> struct ctad : Ts... {}; template <class... Ts> ctad(Ts...)->ctad<Ts...>; ``` and this class was initialized with a list of lambdas capturing by copy, e.g. ``` ctad c {[s](short){}, [s](long){}}; ``` In a release build the bug would manifest itself as a crash in the SROA pass, however, in a debug build the following assert in CGCleanup.cpp would fail: ``` assert(dominatingIP && "no existing variable and no dominating IP!"); ``` By ensuring that a placeholder instruction is emitted even if there's no fields in the class, neither the assert nor the crash is reproducible. See https://bugs.llvm.org/show_bug.cgi?id=40771 Patch by Øystein Dale! llvm-svn: 367042
* [OpenCL] Rename lang mode flag for C++ modeAnastasia Stulova2019-07-251-2/+2
| | | | | | | | | | | | Rename lang mode flag to -cl-std=clc++/-cl-std=CLC++ or -std=clc++/-std=CLC++. This aligns with OpenCL C conversion and removes ambiguity with OpenCL C++. Differential Revision: https://reviews.llvm.org/D65102 llvm-svn: 367008
* [Clang] New loop pragma vectorize_predicateSjoerd Meijer2019-07-251-0/+35
| | | | | | | | | | | | | | | | | | | This adds a new vectorize predication loop hint: #pragma clang loop vectorize_predicate(enable) that can be used to indicate to the vectoriser that all (load/store) instructions should be predicated (masked). This allows, for example, folding of the remainder loop into the main loop. This patch will be followed up with D64916 and D65197. The former is a refactoring in the loopvectorizer and the groundwork to make tail loop folding a more general concept, and in the latter the actual tail loop folding transformation will be implemented. Differential Revision: https://reviews.llvm.org/D64744 llvm-svn: 366989
* [NFC] Relaxed regression tests for PR42665Marco Antognini2019-07-221-30/+3
| | | | | | | | Following up on the buildbot failures, this commits relaxes some tests: instead of checking for specific IR output, it now ensures that the underlying issue (the crash), and only that, doesn't happen. llvm-svn: 366694
* [OpenCL] Improve destructor support in C++ for OpenCLMarco Antognini2019-07-221-0/+61
| | | | | | | This re-applies r366422 with a fix for Bug PR42665 and a new regression test. llvm-svn: 366670
* [Clang] Replace cc1 options '-mdisable-fp-elim' and '-momit-leaf-frame-pointer'Yuanfang Chen2019-07-201-3/+2
| | | | | | | | | | | | | | | | with '-mframe-pointer' After D56351 and D64294, frame pointer handling is migrated to tri-state (all, non-leaf, none) in clang driver and on the function attribute. This patch makes the frame pointer handling cc1 option tri-state. Reviewers: chandlerc, rnk, t.p.northover, MaskRay Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D56353 llvm-svn: 366645
* CodeGet: Init 32bit pointers with 0xFFFFFFFFVitaly Buka2019-07-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Patch makes D63967 effective for 32bit platforms and improves pattern initialization there. It cuts size of 32bit binary compiled with -ftrivial-auto-var-init=pattern by 2% (3% with -Os). Binary size change on CTMark, (with -fuse-ld=lld -Wl,--icf=all, similar results with default linker options) ``` master patch diff Os pattern 7.915580e+05 7.698424e+05 -0.028387 O3 pattern 9.953688e+05 9.752952e+05 -0.019325 ``` Zero vs Pattern on master ``` zero pattern diff Os 7.689712e+05 7.915580e+05 0.031380 O3 9.744796e+05 9.953688e+05 0.021133 ``` Zero vs Pattern with the patch ``` zero pattern diff Os 7.689712e+05 7.698424e+05 0.000789 O3 9.744796e+05 9.752952e+05 0.000742 ``` Reviewers: pcc, eugenis, glider, jfb Reviewed By: jfb Subscribers: hubert.reinterpretcast, dexonsmith, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64597 llvm-svn: 365921
* NFC: Unforget a colon in a few CHECK: directives.Artem Dergachev2019-07-121-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D64526 llvm-svn: 365863
* Handle IntToPtr in isBytewiseValueVitaly Buka2019-07-121-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This helps with more efficient use of memset for pattern initialization From @pcc prototype for -ftrivial-auto-var-init=pattern optimizations Binary size change on CTMark, (with -fuse-ld=lld -Wl,--icf=all, similar results with default linker options) ``` master patch diff Os 8.238864e+05 8.238864e+05 0.0 O3 1.054797e+06 1.054797e+06 0.0 Os zero 8.292384e+05 8.292384e+05 0.0 O3 zero 1.062626e+06 1.062626e+06 0.0 Os pattern 8.579712e+05 8.338048e+05 -0.030299 O3 pattern 1.090502e+06 1.067574e+06 -0.020481 ``` Zero vs Pattern on master ``` zero pattern diff Os 8.292384e+05 8.579712e+05 0.036578 O3 1.062626e+06 1.090502e+06 0.025124 ``` Zero vs Pattern with the patch ``` zero pattern diff Os 8.292384e+05 8.338048e+05 0.003333 O3 1.062626e+06 1.067574e+06 0.003193 ``` Reviewers: pcc, eugenis Subscribers: hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D63967 llvm-svn: 365858
* Codegen, NFC: 32bit test in auto-var-init.cppVitaly Buka2019-07-121-115/+107
| | | | llvm-svn: 365857
* Re-Revert Devirtualize destructor of final class.Jordan Rupprecht2019-07-121-23/+0
| | | | | | | | | | This reverts r365509 (git commit d088720edad9c29ee0d622b5d69092e18a9ac0bd) This is a second revert[1] due to failures in internal test cases (shared offline) found during more thorough testing. [1] Original patch commited as r364100, reverted as r364359, recommitted as r365509 llvm-svn: 365850
* CodeGen: Suppress c++ warnings in testVitaly Buka2019-07-111-0/+2
| | | | llvm-svn: 365835
* CodeGen, NFC: Test for auto-init for 32bit pointersVitaly Buka2019-07-111-0/+16
| | | | llvm-svn: 365822
* Revert Revert Devirtualize destructor of final class.Hiroshi Yamauchi2019-07-091-0/+23
| | | | | | | | | Revert r364359 and recommit r364100. r364100 was reverted as r364359 due to an internal test failure, but it was a false alarm. llvm-svn: 365509
* [ItaniumMangle] Refactor long double/__float128 mangling and fix the mangled ↵Fangrui Song2019-07-091-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | code In gcc PowerPC, long double has 3 mangling schemes: -mlong-double-64: `e` -mlong-double-128 -mabi=ibmlongdouble: `g` -mlong-double-128 -mabi=ieeelongdouble: `u9__ieee128` (gcc <= 8.1: `U10__float128`) The current useFloat128ManglingForLongDouble() bisection is not suitable when we support -mlong-double-128 in clang (D64277). Replace useFloat128ManglingForLongDouble() with getLongDoubleMangling() and getFloat128Mangling() to allow 3 mangling schemes. I also deleted the `getTriple().isOSBinFormatELF()` check (the Darwin support has gone: https://reviews.llvm.org/D50988). For x86, change the mangled code of __float128 from `U10__float128` to `g`. `U10__float128` was wrongly copied from PowerPC. The test will be added to `test/CodeGen/x86-long-double.cpp` in D64277. Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D64276 llvm-svn: 365480
* Replace temporary variable matches in test since r363952 causes anAmy Huang2019-07-081-11/+11
| | | | | | extra temporary variable to be created. llvm-svn: 365357
* [C++2a] Add __builtin_bit_cast, used to implement std::bit_castErik Pilkington2019-07-022-0/+125
| | | | | | | | | | | | | | | | | | This commit adds a new builtin, __builtin_bit_cast(T, v), which performs a bit_cast from a value v to a type T. This expression can be evaluated at compile time under specific circumstances. The compile time evaluation currently doesn't support bit-fields, but I'm planning on fixing this in a follow up (some of the logic for figuring this out is in CodeGen). I'm also planning follow-ups for supporting some more esoteric types that the constexpr evaluator supports, as well as extending __builtin_memcpy constexpr evaluation to use the same infrastructure. rdar://44987528 Differential revision: https://reviews.llvm.org/D62825 llvm-svn: 364954
* Revert r363191 "[MS] Pretend constexpr variable template specializations are ↵Reid Kleckner2019-06-261-11/+0
| | | | | | | | | inline" The next Visual Studio update will fix this issue, and it doesn't make sense to implement this non-conforming behavior going forward. llvm-svn: 364476
* [clang] Fix test failures after the rL364399Djordje Todorovic2019-06-261-4/+4
| | | | llvm-svn: 364402
* [CC1Option] Add the option to enable the debug entry valuesDjordje Todorovic2019-06-261-0/+13
| | | | | | | | | | | | | | | | | | | | | The option enables debug info about parameter's entry values. The example of using the option: clang -g -O2 -Xclang -femit-debug-entry-values test.c In addition, when the option is set add the flag all_call_sites in a subprogram in order to support GNU extension as well. ([3/13] Introduce the debug entry values.) Co-authored-by: Ananth Sowda <asowda@cisco.com> Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com> Co-authored-by: Ivan Baev <ibaev@cisco.com> Differential Revision: https://reviews.llvm.org/D58033 llvm-svn: 364399
* Revert Devirtualize destructor of final class.Rumeet Dhindsa2019-06-251-23/+0
| | | | | | This reverts r364100 (git commit 405c2b16225fc6eaf5eb8ba3ce584699a3b159ef) llvm-svn: 364359
* [cxx2a] P1236R1: the validity of a left shift does not depend on theRichard Smith2019-06-251-0/+19
| | | | | | value of the LHS operand. llvm-svn: 364265
OpenPOWER on IntegriCloud