- May 11, 2017
-
-
Richard Smith authored
in list-initialization, run cleanups for the default argument after each iteration of the initialization loop. We previously only ran the destructor for any temporary once, at the end of the complete loop, rather than once per iteration! Re-commit of r302750, reverted in r302776. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302817 91177308-0d34-0410-b5e6-96231b3b80d8
-
Diana Picus authored
Revert "PR22877: When constructing an array via a constructor with a default argument in list-initialization, run cleanups for the default argument after each iteration of the initialization loop." Revert "clang/test/CodeGenCXX/array-default-argument.cpp: Satisfy targets that have x86_thiscallcc." This reverts commit r302750 and its fixup r302757 because the test is still breaking on some of the ARM bots. array-default-argument.cpp:20:12: error: expected string not found in input // CHECK: {{call|invoke}}[[THISCALL:( x86_thiscallcc)?]] void @_ZN1AC1Ev([[TEMPORARY:.*]]) ^ <stdin>:18:1: note: scanning from here arrayctor.loop: ; preds = %arrayctor.loop, %entry ^ <stdin>:28:2: note: possible intended match here call void @_Z1fv() ^ -- git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302776 91177308-0d34-0410-b5e6-96231b3b80d8
-
Richard Smith authored
in list-initialization, run cleanups for the default argument after each iteration of the initialization loop. We previously only ran the destructor for any temporary once, at the end of the complete loop, rather than once per iteration! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302750 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Mar 30, 2017
-
-
Simon Pilgrim authored
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299083 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Mar 26, 2017
-
-
Gor Nishanov authored
Details: Emit suspend expression which roughly looks like: auto && x = CommonExpr(); if (!x.await_ready()) { llvm_coro_save(); x.await_suspend(...); (*) llvm_coro_suspend(); (**) } x.await_resume(); where the result of the entire expression is the result of x.await_resume() (*) If x.await_suspend return type is bool, it allows to veto a suspend: if (x.await_suspend(...)) llvm_coro_suspend(); (**) llvm_coro_suspend() encodes three possible continuations as a switch instruction: %where-to = call i8 @llvm.coro.suspend(...) switch i8 %where-to, label %coro.ret [ ; jump to epilogue to suspend i8 0, label %yield.ready ; go here when resumed i8 1, label %yield.cleanup ; go here when destroyed ] git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298784 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Dec 23, 2016
-
-
Egor Churaev authored
Summary: Fixed warnings in commit: https://reviews.llvm.org/rL290171 Reviewers: djasper, Anastasia Subscribers: yaxunl, cfe-commits, bader Differential Revision: https://reviews.llvm.org/D27981 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290431 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Dec 20, 2016
-
-
Daniel Jasper authored
This reverts commit r290171. It triggers a bunch of warnings, because the new enumerator isn't handled in all switches. We want a warning-free build. Replied on the commit with more details. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290173 91177308-0d34-0410-b5e6-96231b3b80d8
-
Egor Churaev authored
Summary: Enabling the compression of CLK_NULL_QUEUE to variable of type queue_t. Reviewers: Anastasia Subscribers: cfe-commits, yaxunl, bader Differential Revision: https://reviews.llvm.org/D27569 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290171 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Dec 15, 2016
-
-
Yaxun Liu authored
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289787 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Dec 14, 2016
-
-
Nico Weber authored
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289713 91177308-0d34-0410-b5e6-96231b3b80d8
-
Richard Smith authored
cleanup loop for exception handling. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289623 91177308-0d34-0410-b5e6-96231b3b80d8
-
Richard Smith authored
copy constructors of classes with array members, instead using ArrayInitLoopExpr to represent the initialization loop. This exposed a bug in the static analyzer where it was unable to differentiate between zero-initialized and unknown array values, which has also been fixed here. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289618 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Dec 12, 2016
-
-
Richard Smith authored
initialization of each array element: * ArrayInitLoopExpr is a prvalue of array type with two subexpressions: a common expression (an OpaqueValueExpr) that represents the up-front computation of the source of the initialization, and a subexpression representing a per-element initializer * ArrayInitIndexExpr is a prvalue of type size_t representing the current position in the loop This will be used to replace the creation of explicit index variables in lambda capture of arrays and copy/move construction of classes with array elements, and also C++17 structured bindings of arrays by value (which inexplicably allow copying an array by value, unlike all of C++'s other array declarations). No uses of these nodes are introduced by this change, however. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289413 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Dec 09, 2016
-
-
Yaxun Liu authored
In amdgcn target, null pointers in global, constant, and generic address space take value 0 but null pointers in private and local address space take value -1. Currently LLVM assumes all null pointers take value 0, which results in incorrectly translated IR. To workaround this issue, instead of emit null pointers in local and private address space, a null pointer in generic address space is emitted and casted to local and private address space. Tentative definition of global variables with non-zero initializer will have weak linkage instead of common linkage since common linkage requires zero initializer and does not have explicit section to hold the non-zero value. Virtual member functions getNullPointer and performAddrSpaceCast are added to TargetCodeGenInfo which by default returns ConstantPointerNull and emitting addrspacecast instruction. A virtual member function getNullPointerValue is added to TargetInfo which by default returns 0. Each target can override these virtual functions to get target specific null pointer and the null pointer value for specific address space, and perform specific translations for addrspacecast. Wrapper functions getNullPointer is added to CodegenModule and getTargetNullPointerValue is added to ASTContext to facilitate getting the target specific null pointers and their values. This change has no effect on other targets except amdgcn target. Other targets can provide support of non-zero null pointer in a similar way. This change only provides support for non-zero null pointer for C and OpenCL. Supporting for other languages will be added later incrementally. Differential Revision: https://reviews.llvm.org/D26196 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289252 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Dec 07, 2016
-
-
Richard Smith authored
When an object of class type is initialized from a prvalue of the same type (ignoring cv qualifications), use the prvalue to initialize the object directly instead of inserting a redundant elidable call to a copy constructor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288866 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Jul 28, 2016
-
-
Yaxun Liu authored
Currently Clang use int32 to represent sampler_t, which have been a source of issue for some backends, because in some backends sampler_t cannot be represented by int32. They have to depend on kernel argument metadata and use IPA to find the sampler arguments and global variables and transform them to target specific sampler type. This patch uses opaque pointer type opencl.sampler_t* for sampler_t. For each use of file-scope sampler variable, it generates a function call of __translate_sampler_initializer. For each initialization of function-scope sampler variable, it generates a function call of __translate_sampler_initializer. Each builtin library can implement its own __translate_sampler_initializer(). Since the real sampler type tends to be architecture dependent, allowing it to be initialized by a library function simplifies backend design. A typical implementation of __translate_sampler_initializer could be a table lookup of real sampler literal values. Since its argument is always a literal, the returned pointer is known at compile time and easily optimized to finally become some literal values directly put into image read instructions. This patch is partially based on Alexey Sotkin's work in Khronos Clang (https://github.com/KhronosGroup/SPIR/commit/3d4eec61623502fc306e8c67c9868be2b136e42b). Differential Revision: https://reviews.llvm.org/D21567 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277024 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Jun 28, 2016
-
-
Richard Smith authored
Replace inheriting constructors implementation with new approach, voted into C++ last year as a DR against C++11. Instead of synthesizing a set of derived class constructors for each inherited base class constructor, we make the constructors of the base class visible to constructor lookup in the derived class, using the normal rules for using-declarations. For constructors, UsingShadowDecl now has a ConstructorUsingShadowDecl derived class that tracks the requisite additional information. We create shadow constructors (not found by name lookup) in the derived class to model the actual initialization, and have a new expression node, CXXInheritedCtorInitExpr, to model the initialization of a base class from such a constructor. (This initialization is special because it performs real perfect forwarding of arguments.) In cases where argument forwarding is not possible (for inalloca calls, variadic calls, and calls with callee parameter cleanup), the shadow inheriting constructor is not emitted and instead we directly emit the initialization code into the caller of the inherited constructor. Note that this new model is not perfectly compatible with the old model in some corner cases. In particular: * if B inherits a private constructor from A, and C uses that constructor to construct a B, then we previously required that A befriends B and B befriends C, but the new rules require A to befriend C directly, and * if a derived class has its own constructors (and so its implicit default constructor is suppressed), it may still inherit a default constructor from a base class git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274049 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Mar 09, 2016
-
-
Richard Smith authored
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262965 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Mar 08, 2016
-
-
Richard Smith authored
P0017R1: In C++1z, an aggregate class can have (public non-virtual) base classes; these are initialized as if they were data members. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262963 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Feb 24, 2016
-
-
James Y Knight authored
Fixes PR11517 for SPARC. On most targets, clang lowers va_arg itself, eschewing the use of the llvm vaarg instruction. This is necessary (at least for now) as the type argument to the vaarg instruction cannot represent all the ABI information that is needed to support complex calling conventions. However, on targets with a simpler varrags ABIs, the LLVM instruction can work just fine, and clang can simply lower to it. Unfortunately, even on such targets, vaarg with a struct argument would fail, because the default lowering to vaarg was naive: it didn't take into account the ABI attribute computed by classifyArgumentType. In particular, for the DefaultABIInfo, structs are supposed to be passed indirectly and so llvm's vaarg instruction should be emitted with a pointer argument. Now, vaarg instruction emission is able to use computed ABIArgInfo for the provided argument type, which allows the default ABI support to work for structs too. I haven't touched the EmitVAArg implementation for PPC32_SVR4 or XCore, although I believe both are now redundant, and could be switched over to use the default implementation as well. Differential Revision: http://reviews.llvm.org/D16154 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261717 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Jan 13, 2016
-
-
George Burgess IV authored
In {CG,}ExprConstant.cpp, we weren't treating vector splats properly. This patch makes us treat splats more properly. Additionally, this patch adds a new cast kind which allows a bool->int cast to result in -1 or 0, instead of 1 or 0 (for true and false, respectively), so we can sanely model OpenCL bool->int casts in the AST. Differential Revision: http://reviews.llvm.org/D14877 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257559 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Nov 09, 2015
-
-
Tim Northover authored
When a struct's size is not a power of 2, the corresponding _Atomic() type is promoted to the nearest. We already correctly handled normal C++ expressions of this form, but direct calls to the __c11_atomic_whatever builtins ended up performing dodgy operations on the smaller non-atomic types (e.g. memcpy too much). Later optimisations removed this as undefined behaviour. This patch converts EmitAtomicExpr to allocate its temporaries at the full atomic width, sidestepping the issue. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252507 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Oct 20, 2015
-
-
Alexey Bataev authored
Currently debug info for types used in explicit cast only is not emitted. It happened after a patch for better alignment handling. This patch fixes this bug. Differential Revision: http://reviews.llvm.org/D13582 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250795 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Sep 17, 2015
-
-
Charles Davis authored
Summary: This change adds support for `__builtin_ms_va_list`, a GCC extension for variadic `ms_abi` functions. The existing `__builtin_va_list` support is inadequate for this because `va_list` is defined differently in the Win64 ABI vs. the System V/AMD64 ABI. Depends on D1622. Reviewers: rsmith, rnk, rjmccall CC: cfe-commits Differential Revision: http://reviews.llvm.org/D1623 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247941 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Sep 08, 2015
-
-
John McCall authored
Introduce an Address type to bundle a pointer value with an alignment. Introduce APIs on CGBuilderTy to work with Address values. Change core APIs on CGF/CGM to traffic in Address where appropriate. Require alignments to be non-zero. Update a ton of code to compute and propagate alignment information. As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment helper function to CGF and made use of it in a number of places in the expression emitter. The end result is that we should now be significantly more correct when performing operations on objects that are locally known to be under-aligned. Since alignment is not reliably tracked in the type system, there are inherent limits to this, but at least we are no longer confused by standard operations like derived-to-base conversions and array-to-pointer decay. I've also fixed a large number of bugs where we were applying the complete-object alignment to a pointer instead of the non-virtual alignment, although most of these were hidden by the very conservative approach we took with member alignment. Also, because IRGen now reliably asserts on zero alignments, we should no longer be subject to an absurd but frustrating recurring bug where an incomplete type would report a zero alignment and then we'd naively do a alignmentAtOffset on it and emit code using an alignment equal to the largest power-of-two factor of the offset. We should also now be emitting much more aggressive alignment attributes in the presence of over-alignment. In particular, field access now uses alignmentAtOffset instead of min. Several times in this patch, I had to change the existing code-generation pattern in order to more effectively use the Address APIs. For the most part, this seems to be a strict improvement, like doing pointer arithmetic with GEPs instead of ptrtoint. That said, I've tried very hard to not change semantics, but it is likely that I've failed in a few places, for which I apologize. ABIArgInfo now always carries the assumed alignment of indirect and indirect byval arguments. In order to cut down on what was already a dauntingly large patch, I changed the code to never set align attributes in the IR on non-byval indirect arguments. That is, we still generate code which assumes that indirect arguments have the given alignment, but we don't express this information to the backend except where it's semantically required (i.e. on byvals). This is likely a minor regression for those targets that did provide this information, but it'll be trivial to add it back in a later patch. I partially punted on applying this work to CGBuiltin. Please do not add more uses of the CreateDefaultAligned{Load,Store} APIs; they will be going away eventually. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246985 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Sep 04, 2015
-
-
Reid Kleckner authored
This fixes an issue raised in D12412, where we generated invalid IR. Thanks to Vedant Kumar for coming up with the initial work around. Differential Revision: http://reviews.llvm.org/D12412 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246880 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Jun 10, 2015
-
-
Yunzhong Gao authored
Based on previous discussion on the mailing list, clang currently lacks support for C99 partial re-initialization behavior: Reference: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-April/029188.html Reference: http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_253.htm This patch attempts to fix this problem. Given the following code snippet, struct P1 { char x[6]; }; struct LP1 { struct P1 p1; }; struct LP1 l = { .p1 = { "foo" }, .p1.x[2] = 'x' }; // this example is adapted from the example for "struct fred x[]" in DR-253; // currently clang produces in l: { "\0\0x" }, // whereas gcc 4.8 produces { "fox" }; // with this fix, clang will also produce: { "fox" }; Differential Review: http://reviews.llvm.org/D5789 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239446 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Jun 08, 2015
-
-
Leny Kholodov authored
[CodeGen] Reuse stack space from unused function results (with more accurate unused result detection) This patch fixes issues with unused result detection which were found in patch http://reviews.llvm.org/D9743. Differential Revision: http://reviews.llvm.org/D10042 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239294 91177308-0d34-0410-b5e6-96231b3b80d8
-
- May 20, 2015
-
-
Reid Kleckner authored
Fixes PR23597. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237839 91177308-0d34-0410-b5e6-96231b3b80d8
-
Alexey Bataev authored
Patch fixes codegen for aggregate copying of VLAs. Currently method CodeGenFunction::EmitAggregateCopy() does not support copying of VLAs. Patch checks if the size of the type is 0, then checks if the type is actually a variable-length array. Then it calculates total length for this array and calculates total size of the array in bytes: <total number of elements in array> * aligned_sizeof(ElementType) (if copy assignment is requested). If simple copying is requested, size is calculated like: <total number of elements in array> * aligned_sizeof(ElementType) - aligned_sizeof(ElementType) + sizeof(ElementType). memcpy() is used with this calculated size of the VLA. Differential Revision: http://reviews.llvm.org/D9851 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237768 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Apr 29, 2015
-
-
Richard Smith authored
emitted as a memcpy. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236142 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Apr 24, 2015
-
-
Justin Bogner authored
The RegionCounter type does a lot of legwork, but most of it is only meaningful within the implementation of CodeGenPGO. The uses elsewhere in CodeGen generally just want to increment or read counters, so do that directly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235664 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Apr 06, 2015
-
-
David Blaikie authored
(sorry, keep forgetting that) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234129 91177308-0d34-0410-b5e6-96231b3b80d8
-
David Blaikie authored
Looks like the VTable code in particular will need some work to pass around the pointee type explicitly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234128 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Feb 25, 2015
-
-
David Majnemer authored
We would wrongfully reject (a.~A)() in both the destructor and pseudo-destructor cases. This fixes PR22668. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230512 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Feb 14, 2015
-
-
David Majnemer authored
This reverts commit r229123. It was a red herring, the bug was present without r229082. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229205 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Feb 13, 2015
-
-
Nico Weber authored
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229123 91177308-0d34-0410-b5e6-96231b3b80d8
-
David Majnemer authored
The /volatile:ms semantics turn volatile loads and stores into atomic acquire and release operations. This distinction is important because volatile memory operations do not form a happens-before relationship with non-atomic memory. This means that a volatile store is not sufficient for implementing a mutex unlock routine. Differential Revision: http://reviews.llvm.org/D7580 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229082 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Feb 09, 2015
-
-
David Blaikie authored
DebugInfo: Refactor default arg handling into a common place (instead of handling in repeatedly for aggregate, complex, and scalar types) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228591 91177308-0d34-0410-b5e6-96231b3b80d8
-
David Blaikie authored
Matches the existing code for scalar default arguments. Complex default arguments probably need the same handling too (test/fix to that coming next). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228588 91177308-0d34-0410-b5e6-96231b3b80d8
-