summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* P0035R4: Semantic analysis and code generation for C++17 overalignedRichard Smith2016-10-102-169/+221
| | | | | | allocation. llvm-svn: 283722
* [CUDA] Do a better job at detecting wrong-side calls.Justin Lebar2016-10-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Move CheckCUDACall from ActOnCallExpr and BuildDeclRefExpr to DiagnoseUseOfDecl. This lets us catch some edge cases we were missing, specifically around class operators. This necessitates a few other changes: - Avoid emitting duplicate deferred diags in CheckCUDACall. Previously we'd carefully placed our call to CheckCUDACall such that it would only ever run once for a particular callsite. But now this isn't the case. - Emit deferred diagnostics from a template specialization/instantiation's primary template, in addition to from the specialization/instantiation itself. DiagnoseUseOfDecl ends up putting the deferred diagnostics on the template, rather than the specialization, so we need to check both. Reviewers: rsmith Subscribers: cfe-commits, tra Differential Revision: https://reviews.llvm.org/D24573 llvm-svn: 283637
* PR22924, PR22845, some of CWG1464: When checking the initializer for an arrayRichard Smith2016-10-051-27/+66
| | | | | | | | | | | | | | | | | | new expression, distinguish between the case of a constant and non-constant initializer. In the former case, if the bound is erroneous (too many initializer elements, bound is negative, or allocated size overflows), reject, and take the bound into account when determining whether we need to default-construct any elements. In the remanining cases, move the logic to check for default-constructibility of trailing elements into the initialization code rather than inventing a bogus array bound, to cope with cases where the number of initialized elements is not the same as the number of initializer list elements (this can happen due to string literal initialization or brace elision). This also fixes rejects-valid and crash-on-valid errors when initializing a new'd array of character type from a braced string literal. llvm-svn: 283406
* [CUDA] Mark device functions as nounwind.Justin Lebar2016-10-042-0/+7
| | | | | | | | | | | | | | | | | | | Summary: This prevents clang from emitting 'invoke's and catch statements. Things previously mostly worked thanks to TryToMarkNoThrow() in CodeGenFunction. But this is not a proper IPO, and it doesn't properly handle cases like mutual recursion. Fixes bug 30593. Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25166 llvm-svn: 283272
* [CUDA] Destroy deferred diagnostics before destroying the ASTContext's ↵Justin Lebar2016-10-041-0/+3
| | | | | | | | | | | | | | | | PartialDiagnostic allocator. Summary: This will let us (in a separate patch) allocate deferred diagnostics in the ASTContext's PartialDiagnostic arena. Reviewers: rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25260 llvm-svn: 283271
* Separate builtins for x84-64 and i386; implement __mulh and __umulhAlbert Gutowski2016-10-041-0/+24
| | | | | | | | | | | | Summary: We need x86-64-specific builtins if we want to implement some of the MS intrinsics - winnt.h contains definitions of some functions for i386, but not for x86-64 (for example _InterlockedOr64), which means that we cannot treat them as builtins for both i386 and x86-64, because then we have definitions of builtin functions in winnt.h on i386. Reviewers: thakis, majnemer, hans, rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24598 llvm-svn: 283264
* [clang] make reciprocal estimate codegen a function attributeSanjay Patel2016-10-042-3/+9
| | | | | | | | | | | | | | | | The motivation for the change is that we can't have pseudo-global settings for codegen living in TargetOptions because that doesn't work with LTO. Ideally, these reciprocal attributes will be moved to the instruction-level via FMF, metadata, or something else. But making them function attributes is at least an improvement over the current state. I'm committing this patch ahead of the related LLVM patch to avoid bot failures, but if that patch needs to be reverted, then this should be reverted too. Differential Revision: https://reviews.llvm.org/D24815 llvm-svn: 283251
* [ubsan] Disable bounds-check for flexible array ivarsVedant Kumar2016-10-041-0/+2
| | | | | | | | | This eliminates a class of false positives for -fsanitize=array-bounds on instrumented ObjC projects. Differential Revision: https://reviews.llvm.org/D22227 llvm-svn: 283249
* [coroutines] Adding builtins for coroutine intrinsics and backendutil support.Gor Nishanov2016-10-035-0/+152
| | | | | | | | | | | | | Summary: With this commit simple coroutines can be created in plain C using coroutine builtins. Reviewers: rnk, EricWF, rsmith Subscribers: modocache, mgorny, mehdi_amini, beanz, cfe-commits Differential Revision: https://reviews.llvm.org/D24373 llvm-svn: 283155
* [ARC] Ignore qualifiers in copy-restore expressionsVedant Kumar2016-10-031-1/+1
| | | | | | | | | | | | | | | | When ARC is enabled, an ObjCIndirectCopyRestoreExpr models the passing of a function argument s.t: * The argument is copied into a temporary, * The temporary is passed into the function, and * After the function call completes, the temporary is move-assigned back to the original location of the argument. The argument type and the parameter type must agree "except possibly in qualification". This commit weakens an assertion in EmitCallArg() to actually reflect that. llvm-svn: 283116
* [OpenCL] Fix bug in __builtin_astype causing invalid LLVM cast instructionsYaxun Liu2016-10-031-3/+52
| | | | | | | | | | | | __builtin_astype is used to cast OpenCL opaque types to other types, as such, it needs to be able to handle casting from and to pointer types correctly. Current it cannot handle 1) casting between pointers of different addr spaces 2) casting between pointer type and non-pointer types. This patch fixes that. Differential Revision: https://reviews.llvm.org/D25123 llvm-svn: 283114
* Alias must point to a definitionAditya Kumar2016-10-021-8/+6
| | | | | | | | | | | | | | | Reapplying the patch after modifying the test case. Inlining the destructor caused the compiler to generate bad IR which failed the Verifier in the backend. https://llvm.org/bugs/show_bug.cgi?id=30341 This patch disables alias to available_externally definitions. Reviewers: eugenis, rsmith Differential Revision: https://reviews.llvm.org/D24682 llvm-svn: 283063
* [PowerPC] Enable soft-float for PPC64, and +soft-float -> -hard-floatHal Finkel2016-10-021-7/+19
| | | | | | | | | | Enable soft-float support on PPC64, as the backend now supports it. Also, the backend now uses -hard-float instead of +soft-float, so set the target features accordingly. Fixes PR26970. llvm-svn: 283061
* Use StringRef for MemoryBuffer identifier API (NFC)Mehdi Amini2016-10-011-1/+1
| | | | llvm-svn: 283043
* Use StringRef in Pass/PassManager APIs (NFC)Mehdi Amini2016-10-011-1/+1
| | | | llvm-svn: 283004
* Use StringRef in Triple API (NFC)Mehdi Amini2016-10-011-4/+5
| | | | llvm-svn: 282996
* CodeGen: inherit DLLExport attribute in Windows ItaniumSaleem Abdulrasool2016-09-301-11/+19
| | | | | | | | When emitting the fundamental type information constants, inherit the DLLExportAttr from `__fundamental_type_info`. We would previously not honor the `__declspec(dllexport)` on the type information. llvm-svn: 282980
* [MS] Implement __iso_volatile loads/stores as builtinsMartin Storsjo2016-09-301-0/+35
| | | | | | | | | | | | | | | | | | | | These are supposed to produce the same as normal volatile pointer loads/stores. When -volatile:ms is specified, normal volatile pointers are forced to have atomic semantics (as is the default on x86 in MSVC mode). In that case, these builtins should still produce non-atomic volatile loads/stores without acquire/release semantics, which the new test verifies. These are only available on ARM (and on AArch64, although clang doesn't support AArch64/Windows yet). This implements what is missing for PR30394, making it possible to compile C++ for ARM in MSVC mode with MSVC headers. Differential Revision: https://reviews.llvm.org/D24986 llvm-svn: 282900
* Cosmetic fix: deleted unnecessary line break in comment.Victor Leschuk2016-09-301-2/+1
| | | | llvm-svn: 282846
* Move UTF functions into namespace llvm.Justin Lebar2016-09-301-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This lets people link against LLVM and their own version of the UTF library. I determined this only affects llvm, clang, lld, and lldb by running $ git grep -wl 'UTF[0-9]\+\|\bConvertUTF\bisLegalUTF\|getNumBytesFor' | cut -f 1 -d '/' | sort | uniq clang lld lldb llvm Tested with ninja lldb ninja check-clang check-llvm check-lld (ninja check-lldb doesn't complete for me with or without this patch.) Reviewers: rnk Subscribers: klimek, beanz, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D24996 llvm-svn: 282822
* Switch to a different workaround for unimplementability of P0145R3 in MS ABIs.Richard Smith2016-09-294-37/+64
| | | | | | | | | | | | | | | | | | | Instead of ignoring the evaluation order rule, ignore the "destroy parameters in reverse construction order" rule for the small number of problematic cases. This only causes incorrect behavior in the rare case where both parameters to an overloaded operator <<, >>, ->*, &&, ||, or comma are of class type with non-trivial destructor, and the program is depending on those parameters being destroyed in reverse construction order. We could do a little better here by reversing the order of parameter destruction for those functions (and reversing the argument evaluation order for all direct calls, not just those with operator syntax), but that is not a complete solution to the problem, as the same situation can be reached by an indirect function call. Approach reviewed off-line by rnk. llvm-svn: 282777
* Revert "[PR30341] Alias must point to a definition"Aditya Kumar2016-09-291-6/+8
| | | | | | | | This reverts commit r282679. Ninja check fails, reverting to debug the issue. llvm-svn: 282710
* [PR30341] Alias must point to a definitionAditya Kumar2016-09-291-8/+6
| | | | | | | | | | | | | Inlining the destructor caused the compiler to generate bad IR which failed the Verifier in the backend. https://llvm.org/bugs/show_bug.cgi?id=30341 This patch disables alias to available_externally definitions. Reviewers: eugenis, rsmith Differential Revision: https://reviews.llvm.org/D24682 llvm-svn: 282679
* Re-commit r282556, reverted in r282564, with a fix to CallArgList::addFrom toRichard Smith2016-09-286-26/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | function correctly when targeting MS ABIs (this appears to have never mattered prior to this change). Update test case to always cover both 32-bit and 64-bit Windows ABIs, since they behave somewhat differently from each other here. Update test case to also cover operators , && and ||, which it appears are also affected by P0145R3 (they're not explicitly called out by the design document, but this is the emergent behavior of the existing wording). Original commit message: P0145R3 (C++17 evaluation order tweaks): evaluate the right-hand side of assignment and compound-assignment operators before the left-hand side. (Even if it's an overloaded operator.) This completes the implementation of P0145R3 + P0400R0 for all targets except Windows, where the evaluation order guarantees for <<, >>, and ->* are unimplementable as the ABI requires the function arguments are evaluated from right to left (because parameter destructors are run from left to right in the callee). llvm-svn: 282619
* [CUDA] added __nvvm_atom_{sys|cta}_* builtins.Artem Belevich2016-09-281-1/+110
| | | | | | | | These builtins are available on sm_60+ GPU only. Differential Revision: https://reviews.llvm.org/D24944 llvm-svn: 282609
* Revert r282556. This change made several bots unhappy.Richard Smith2016-09-285-58/+20
| | | | llvm-svn: 282564
* P0145R3 (C++17 evaluation order tweaks): evaluate the right-hand side ofRichard Smith2016-09-275-20/+58
| | | | | | | | | | | | | assignment and compound-assignment operators before the left-hand side. (Even if it's an overloaded operator.) This completes the implementation of P0145R3 + P0400R0 for all targets except Windows, where the evaluation order guarantees for <<, >>, and ->* are unimplementable as the ABI requires the function arguments are evaluated from right to left (because parameter destructors are run from left to right in the callee). llvm-svn: 282556
* [Coverage] The coverage region for switch covers the code after the switch.Alex Lorenz2016-09-271-1/+5
| | | | | | | | | | | | | | This patch fixes a regression introduced in r262697 that changed the way the coverage regions for switches are constructed. The PGO instrumentation counter for a switch statement refers to the counter at the exit of the switch. Therefore, the coverage region for the switch statement should cover the code that comes after the switch, and not the switch statement itself. rdar://28480997 Differential Revision: https://reviews.llvm.org/D24981 llvm-svn: 282554
* Shorten DiagnosticInfoOptimizationRemark* to OptimizationRemark*. NFCAdam Nemet2016-09-271-21/+15
| | | | | | | With the new streaming interface in LLVM, these class names need to be typed a lot and it's way too looong. llvm-svn: 282545
* Adapt to LLVM optimization remark interface change. NFCAdam Nemet2016-09-271-1/+1
| | | | llvm-svn: 282540
* Revert "Adapt to LLVM optimization remark interface change. NFC"Adam Nemet2016-09-271-1/+1
| | | | | | This reverts commit r282500. llvm-svn: 282504
* Adapt to LLVM optimization remark interface change. NFCAdam Nemet2016-09-271-1/+1
| | | | llvm-svn: 282500
* [Power9] Builtins for ELF v.2 ABI conformance - front end portionNemanja Ivanovic2016-09-271-0/+19
| | | | | | | | | | This patch corresponds to review: https://reviews.llvm.org/D24397 It adds the __POWER9_VECTOR__ macro and the -mpower9-vector option along with a number of altivec.h functions (refer to the code review for a list). llvm-svn: 282481
* Remove default argument from lambda to appease old MSVC.Richard Smith2016-09-271-1/+1
| | | | llvm-svn: 282464
* P0145R3 (C++17 evaluation order tweaks): evaluate the base expression beforeRichard Smith2016-09-261-3/+3
| | | | | | the pointer-to-member expression in calls through .* and ->* expressions. llvm-svn: 282457
* P0145R3 (C++17 evaluation order tweaks): consistently emit the LHS of arrayRichard Smith2016-09-261-15/+35
| | | | | | | subscripting before the RHS, regardless of which is the base and which is the index. llvm-svn: 282453
* [AMDGPU] Expose flat work group size, register and wave control attributesKonstantin Zhuravlyov2016-09-261-11/+41
| | | | | | | | | __attribute__((amdgpu_flat_work_group_size(<min>, <max>))) - request minimum and maximum flat work group size __attribute__((amdgpu_waves_per_eu(<min>[, <max>]))) - request minimum and/or maximum waves per execution unit Differential Revision: https://reviews.llvm.org/D24513 llvm-svn: 282371
* Update clang for r282299.Peter Collingbourne2016-09-231-17/+3
| | | | llvm-svn: 282301
* Revert of r282255 because of "Fell off the end of a string-switch" buildbotSjoerd Meijer2016-09-231-7/+0
| | | | | | failures. llvm-svn: 282257
* Fix for r280064 that added options for fp denormals and exceptions.Sjoerd Meijer2016-09-231-0/+7
| | | | | | These options were forgotten to be copied in setCommandLineOpts. llvm-svn: 282255
* [OpenCL] Augment pipe built-ins with pipe packet size and alignment.Alexey Bader2016-09-233-13/+59
| | | | | | | | | | Reviewers: Anastasia, vpykhtin Subscribers: dmitry, cfe-commits Differential Revision: https://reviews.llvm.org/D23992 llvm-svn: 282252
* CodeGen: further merge cstring literal constructionSaleem Abdulrasool2016-09-201-13/+19
| | | | | | | | Use the new CreateCStringLiteral in an additional site. Now all the C string literals are created in one function. Furthermore, mark the additional literal as an `unnamed_addr constant`. llvm-svn: 281997
* Replace 'isProvablyNonNull' with existing utility llvm::IsKnownNonNull which ↵Nick Lewycky2016-09-201-6/+3
| | | | | | | | handles more cases. Noticed by inspection. Because of how the IR generation works, this isn't expected to cause an observable difference. llvm-svn: 281979
* Remove InstructionCombining and its related pass from sample pgo passes as ↵Dehao Chen2016-09-191-13/+0
| | | | | | | | | | | | | | we can handle "invoke" correctly. Summary: We previously relies on InstructionCombining pass to remove invoke instructions. Now that we can inline invoke instructions correctly, we do not need these passes any more. Reviewers: dnovillo Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D24730 llvm-svn: 281910
* CodeGen: mark ObjC cstring literals as unnamed_addrSaleem Abdulrasool2016-09-181-1/+3
| | | | | | | | These are all emitted into a section with a cstring_literal attribute. The attribute permits the linker to coalesce the string contents. The address of the strings are not important. llvm-svn: 281855
* CodeGen: mark ObjC cstring literals as constantSaleem Abdulrasool2016-09-181-1/+2
| | | | | | | | These strings are constants, mark them as such. This doesn't matter too much in practice on MachO since the constants are placed into a special section and not referred to directly. llvm-svn: 281854
* CodeGen: refactor the ObjC cstring literal creationSaleem Abdulrasool2016-09-161-44/+57
| | | | | | | | | This refactors the cstring literal creation as mentioned in the couple of FIXMEs littered in the various invocations to CreateMetadataVar. This centralises the definition of the literals, and will enable changing the literal creation to a single site. NFC. llvm-svn: 281798
* Fix a couple of wrong-code bugs in switch-on-constant optimization:Richard Smith2016-09-163-2/+58
| | | | | | | | | | | | * recurse through intermediate LabelStmts and AttributedStmts when checking whether a statement inside a switch declares a variable * if the end of a compound statement is reachable from the chosen case label, and the compound statement contains a variable declaration, it's not valid to just emit the contents of the compound statement -- we must emit the statement itself or we lose the scope (and thus end lifetimes at the wrong point) llvm-svn: 281797
* CodeGen: use pointer rather than reference in range loopSaleem Abdulrasool2016-09-161-2/+2
| | | | | | | | Address post-commit comments from Justin Bogner. Explicitly indicate that the dereferenced iterator provides a pointer rather than a reference. NFC. llvm-svn: 281730
* Alter the iOS/tvOS ARM64 C++ ABI to ignore the upper half of theJohn McCall2016-09-161-2/+12
| | | | | | | | | | | | | | | | | | | | | virtual table offset in a member function pointer. We are reserving this space for future ABI use relating to alternative v-table configurations. In the meantime, continue to zero-initialize this space when actually emitting a member pointer literal. This will successfully interoperate with existing compilers. Future versions of the compiler may place additional data in this location, and at that point, code emitted by compilers prior to this patch will fail if exposed to such a member pointer. This is therefore a somewhat hard ABI break. However, because it is limited to an uncommon case of an uncommon language feature, and especially because interoperation with the standard library does not depend on member pointers, we believe that with a sufficiently advance compiler change the impact of this break will be minimal in practice. llvm-svn: 281693
OpenPOWER on IntegriCloud