| #
c7d5c94f |
| 17-Sep-2015 |
Charles Davis <[email protected]> |
Support __builtin_ms_va_list.
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 fo
Support __builtin_ms_va_list.
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
llvm-svn: 247941
show more ...
|
| #
7f416cc4 |
| 08-Sep-2015 |
John McCall <[email protected]> |
Compute and preserve alignment more faithfully in IR-generation.
Introduce an Address type to bundle a pointer value with an alignment. Introduce APIs on CGBuilderTy to work with Address values. C
Compute and preserve alignment more faithfully in IR-generation.
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.
llvm-svn: 246985
show more ...
|
| #
5ee4b9a1 |
| 04-Sep-2015 |
Reid Kleckner <[email protected]> |
Don't use unreachable as a placeholder, it confuses EmitBlock
This fixes an issue raised in D12412, where we generated invalid IR.
Thanks to Vedant Kumar for coming up with the initial work around.
Don't use unreachable as a placeholder, it confuses EmitBlock
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
llvm-svn: 246880
show more ...
|
|
Revision tags: llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3, llvmorg-3.7.0-rc2, llvmorg-3.7.0-rc1, llvmorg-3.6.2, llvmorg-3.6.2-rc1 |
|
| #
cb77930d |
| 10-Jun-2015 |
Yunzhong Gao <[email protected]> |
Implementing C99 partial re-initialization behavior (DR-253)
Based on previous discussion on the mailing list, clang currently lacks support for C99 partial re-initialization behavior: Reference: ht
Implementing C99 partial re-initialization behavior (DR-253)
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
llvm-svn: 239446
show more ...
|
| #
6aab1117 |
| 08-Jun-2015 |
Leny Kholodov <[email protected]> |
[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.ll
[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
llvm-svn: 239294
show more ...
|
| #
892bb0ca |
| 20-May-2015 |
Reid Kleckner <[email protected]> |
Evaluate union cast subexpressions when the cast value is unused
Fixes PR23597.
llvm-svn: 237839
|
| #
16dc7b68 |
| 20-May-2015 |
Alexey Bataev <[email protected]> |
Fix for aggregate copying of variable length arrays.
Patch fixes codegen for aggregate copying of VLAs. Currently method CodeGenFunction::EmitAggregateCopy() does not support copying of VLAs. Patch
Fix for aggregate copying of variable length arrays.
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
llvm-svn: 237768
show more ...
|
|
Revision tags: llvmorg-3.6.1, llvmorg-3.6.1-rc1 |
|
| #
419bd094 |
| 29-Apr-2015 |
Richard Smith <[email protected]> |
PR23373: A defaulted union copy constructor that is not trivial must still be emitted as a memcpy.
llvm-svn: 236142
|
| #
66242d6c |
| 23-Apr-2015 |
Justin Bogner <[email protected]> |
InstrProf: Stop using RegionCounter outside of CodeGenPGO (NFC)
The RegionCounter type does a lot of legwork, but most of it is only meaningful within the implementation of CodeGenPGO. The uses else
InstrProf: Stop using RegionCounter outside of CodeGenPGO (NFC)
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.
llvm-svn: 235664
show more ...
|
| #
2e80428d |
| 05-Apr-2015 |
David Blaikie <[email protected]> |
clang-format my last commit
(sorry, keep forgetting that)
llvm-svn: 234129
|
| #
1ed728c4 |
| 05-Apr-2015 |
David Blaikie <[email protected]> |
[opaque pointer type] More GEP API migrations
Looks like the VTable code in particular will need some work to pass around the pointee type explicitly.
llvm-svn: 234128
|
|
Revision tags: llvmorg-3.5.2, llvmorg-3.5.2-rc1 |
|
| #
ced8bdf7 |
| 25-Feb-2015 |
David Majnemer <[email protected]> |
Sema: Parenthesized bound destructor member expressions can be called
We would wrongfully reject (a.~A)() in both the destructor and pseudo-destructor cases.
This fixes PR22668.
llvm-svn: 230512
|
|
Revision tags: llvmorg-3.6.0, llvmorg-3.6.0-rc4 |
|
| #
a5b195a1 |
| 14-Feb-2015 |
David Majnemer <[email protected]> |
Revert "Revert r229082 for a bit, it caused PR22577."
This reverts commit r229123. It was a red herring, the bug was present without r229082.
llvm-svn: 229205
|
| #
7ce96b85 |
| 13-Feb-2015 |
Nico Weber <[email protected]> |
Revert r229082 for a bit, it caused PR22577.
llvm-svn: 229123
|
| #
abc482ef |
| 13-Feb-2015 |
David Majnemer <[email protected]> |
MS ABI: Implement /volatile:ms
The /volatile:ms semantics turn volatile loads and stores into atomic acquire and release operations. This distinction is important because volatile memory operations
MS ABI: Implement /volatile:ms
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
llvm-svn: 229082
show more ...
|
|
Revision tags: llvmorg-3.6.0-rc3 |
|
| #
38b25914 |
| 09-Feb-2015 |
David Blaikie <[email protected]> |
DebugInfo: Refactor default arg handling into a common place (instead of handling in repeatedly for aggregate, complex, and scalar types)
llvm-svn: 228591
|
| #
2221aba8 |
| 09-Feb-2015 |
David Blaikie <[email protected]> |
DebugInfo: Suppress the location of instructions in aggregate default arguments.
Matches the existing code for scalar default arguments. Complex default arguments probably need the same handling too
DebugInfo: Suppress the location of instructions in aggregate default arguments.
Matches the existing code for scalar default arguments. Complex default arguments probably need the same handling too (test/fix to that coming next).
llvm-svn: 228588
show more ...
|
|
Revision tags: llvmorg-3.6.0-rc2 |
|
| #
9b479666 |
| 25-Jan-2015 |
David Blaikie <[email protected]> |
DebugInfo: Use the preferred location rather than the start location for expression line info
This causes things like assignment to refer to the '=' rather than the LHS when attributing the store in
DebugInfo: Use the preferred location rather than the start location for expression line info
This causes things like assignment to refer to the '=' rather than the LHS when attributing the store instruction, for example.
There were essentially 3 options for this:
* The beginning of an expression (this was the behavior prior to this commit). This meant that stepping through subexpressions would bounce around from subexpressions back to the start of the outer expression, etc. (eg: x + y + z would go x, y, x, z, x (the repeated 'x's would be where the actual addition occurred)).
* The end of an expression. This seems to be what GCC does /mostly/, and certainly this for function calls. This has the advantage that progress is always 'forwards' (never jumping backwards - except for independent subexpressions if they're evaluated in interesting orders, etc). "x + y + z" would go "x y z" with the additions occurring at y and z after the respective loads. The problem with this is that the user would still have to think fairly hard about precedence to realize which subexpression is being evaluated or which operator overload is being called in, say, an asan backtrace.
* The preferred location or 'exprloc'. In this case you get sort of what you'd expect, though it's a bit confusing in its own way due to going 'backwards'. In this case the locations would be: "x y + z +" in lovely postfix arithmetic order. But this does mean that if the op+ were an operator overload, say, and in a backtrace, the backtrace will point to the exact '+' that's being called, not to the end of one of its operands.
(actually the operator overload case doesn't work yet for other reasons, but that's being fixed - but this at least gets scalar/complex assignments and other plain operators right)
llvm-svn: 227027
show more ...
|
| #
01fb5fb1 |
| 18-Jan-2015 |
David Blaikie <[email protected]> |
DebugInfo: Attribute aggregate expressions to the source location of the expression
Just as r225956 did for scalar expressions (CGExprScalar::Visit), do the same for aggregate expressions.
llvm-svn
DebugInfo: Attribute aggregate expressions to the source location of the expression
Just as r225956 did for scalar expressions (CGExprScalar::Visit), do the same for aggregate expressions.
llvm-svn: 226388
show more ...
|
|
Revision tags: llvmorg-3.6.0-rc1, llvmorg-3.5.1, llvmorg-3.5.1-rc2, llvmorg-3.5.1-rc1, llvmorg-3.5.0, llvmorg-3.5.0-rc4, llvmorg-3.5.0-rc3, llvmorg-3.5.0-rc2 |
|
| #
77be48ac |
| 31-Jul-2014 |
Richard Smith <[email protected]> |
PR18097: Support initializing an _Atomic(T) from an object of C++ class type T or a class derived from T. We already supported this when initializing _Atomic(T) from T for most (and maybe all) other
PR18097: Support initializing an _Atomic(T) from an object of C++ class type T or a class derived from T. We already supported this when initializing _Atomic(T) from T for most (and maybe all) other reasonable values of T.
llvm-svn: 214390
show more ...
|
|
Revision tags: llvmorg-3.5.0-rc1 |
|
| #
8edda962 |
| 13-Jun-2014 |
Richard Smith <[email protected]> |
A non-trivial array-fill expression isn't necessarily a CXXConstructExpr. It could be an InitListExpr that runs constructors in C++11 onwards. Fixes a recent regression (introduced in r210091).
llvm
A non-trivial array-fill expression isn't necessarily a CXXConstructExpr. It could be an InitListExpr that runs constructors in C++11 onwards. Fixes a recent regression (introduced in r210091).
llvm-svn: 210954
show more ...
|
| #
9213a6bf |
| 03-Jun-2014 |
Richard Smith <[email protected]> |
Remove incorrect assertion.
llvm-svn: 210092
|
| #
8a13c418 |
| 21-May-2014 |
Craig Topper <[email protected]> |
[C++11] Use 'nullptr'. CodeGen edition.
llvm-svn: 209272
|
|
Revision tags: llvmorg-3.4.2, llvmorg-3.4.2-rc1, llvmorg-3.4.1, llvmorg-3.4.1-rc2, llvmorg-3.4.1-rc1 |
|
| #
e8a8baef |
| 08-Mar-2014 |
Aaron Ballman <[email protected]> |
[C++11] Replacing RecordDecl iterators field_begin() and field_end() with iterator_range fields(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203355
|
| #
bf854f0f |
| 17-Feb-2014 |
Bob Wilson <[email protected]> |
Change PGO instrumentation to compute counts in a separate AST traversal.
Previously, we made one traversal of the AST prior to codegen to assign counters to the ASTs and then propagated the count v
Change PGO instrumentation to compute counts in a separate AST traversal.
Previously, we made one traversal of the AST prior to codegen to assign counters to the ASTs and then propagated the count values during codegen. This patch now adds a separate AST traversal prior to codegen for the -fprofile-instr-use option to propagate the count values. The counts are then saved in a map from which they can be retrieved during codegen.
This new approach has several advantages:
1. It gets rid of a lot of extra PGO-related code that had previously been added to codegen.
2. It fixes a serious bug. My original implementation (which was mailed to the list but never committed) used 3 counters for every loop. Justin improved it to move 2 of those counters into the less-frequently executed breaks and continues, but that turned out to produce wrong count values in some cases. The solution requires visiting a loop body before the condition so that the count for the condition properly includes the break and continue counts. Changing codegen to visit a loop body first would be a fairly invasive change, but with a separate AST traversal, it is easy to control the order of traversal. I've added a testcase (provided by Justin) to make sure this works correctly.
3. It improves the instrumentation overhead, reducing the number of counters for a loop from 3 to 1. We no longer need dedicated counters for breaks and continues, since we can just use the propagated count values when visiting breaks and continues.
To make this work, I needed to make a change to the way we count case statements, going back to my original approach of not including the fall-through in the counter values. This was necessary because there isn't always an AST node that can be used to record the fall-through count. Now case statements are handled the same as default statements, with the fall-through paths branching over the counter increments. While I was at it, I also went back to using this approach for do-loops -- omitting the fall-through count into the loop body simplifies some of the calculations and make them behave the same as other loops. Whenever we start using this instrumentation for coverage, we'll need to add the fall-through counts into the counter values.
llvm-svn: 201528
show more ...
|