summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/vla.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Clean up AMDGCN testsYaxun Liu2018-02-151-15/+15
| | | | | | | Differential Revision: https://reviews.llvm.org/D43340 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325279 91177308-0d34-0410-b5e6-96231b3b80d8
* [Debug] Annotate compiler generated range-for loop variables.Matt Davis2018-02-141-5/+5
| | | | | | | | | | | | | | | | | | Summary: This change aims to simplify debugging by annotating the range-for loop artificial variables (range, begin, end) with the scope depth. Reviewers: rsmith, dblaikie Reviewed By: dblaikie Subscribers: dblaikie, cfe-commits Tags: #debug-info Differential Revision: https://reviews.llvm.org/D42813 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325175 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Fix insertion position of addrspace cast for allocaYaxun Liu2017-10-301-8/+23
| | | | | | | | | | | | | | | | | | | | | For non-zero alloca addr space, alloca is usually casted to default addr space immediately. For non-vla, alloca is inserted at AllocaInsertPt, therefore the addr space cast should also be insterted at AllocaInsertPt. However, for vla, alloca is inserted at the current insertion point of IRBuilder, therefore the addr space cast should also inserted at the current insertion point of IRBuilder. Currently clang always insert addr space cast at AllocaInsertPt, which causes invalid IR. This patch fixes that. Differential Revision: https://reviews.llvm.org/D39374 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316909 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence buildbots by tweaking an IR codegen test to be less specific w ↵Faisal Vali2017-05-151-1/+1
| | | | | | register names. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303030 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] Remove some comments (IR aid) from a test file erroneous committed in ↵Faisal Vali2017-05-151-26/+0
| | | | | | r303026 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303027 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR32933: crash on lambda capture of VLAFaisal Vali2017-05-151-1/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://bugs.llvm.org/show_bug.cgi?id=32933 Turns out clang wasn't really handling vla's (*) in C++11's for-range entirely correctly. For e.g. This would lead to generation of buggy IR: void foo(int b) { int vla[b]; b = -1; // This store would affect the '__end = vla + b' for (int &c : vla) c = 0; } Additionally, code-gen would get confused when VLA's were reference-captured by lambdas, and then used in a for-range, which would result in an attempt to generate IR for '__end = vla + b' within the lambda's body - without any capture of 'b' - hence the assertion. This patch modifies clang, so that for VLA's it translates the end pointer approximately into: __end = __begin + sizeof(vla)/sizeof(vla->getElementType()) As opposed to the __end = __begin + b; I considered passing a magic value into codegen - or having codegen special case the '__end' variable when it referred to a variably-modified type, but I decided against that approach, because it smelled like I would be increasing a complicated form of coupling, that I think would be even harder to maintain than the above approach (which can easily be optimized (-O1) to refer to the run-time bound that was calculated upon array's creation or copied into the lambda's closure object). (*) why oh why gcc would you enable this by default?! ;) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303026 91177308-0d34-0410-b5e6-96231b3b80d8
* Update Clang tests to handle explicitly typed load changes in LLVM.David Blaikie2015-02-271-6/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230795 91177308-0d34-0410-b5e6-96231b3b80d8
* Update Clang tests to handle explicitly typed gep changes in LLVM.David Blaikie2015-02-271-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230783 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Fix linkage of reference temporariesDavid Majnemer2014-04-281-1/+1
| | | | | | | | | | | | | | | Summary: A reference temporary should inherit the linkage of the variable it initializes. Otherwise, we may hit cases where a reference temporary wouldn't have the same value in all translation units. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3515 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207451 91177308-0d34-0410-b5e6-96231b3b80d8
* CHECK-LABEL-ify some code gen tests to improve diagnostic experience when ↵Stephen Lin2013-08-151-1/+1
| | | | | | tests fail. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188447 91177308-0d34-0410-b5e6-96231b3b80d8
* Unlike in C++03, a constant-expression is not an unevaluated operand in C++11.Richard Smith2011-12-201-1/+14
| | | | | | | | | | | | | | | | | | | | | | | Split out a new ExpressionEvaluationContext flag for this case, and don't treat it as unevaluated in C++11. This fixes some crash-on-invalids where we would allow references to class members in potentially-evaluated constant expressions in static member functions, and also fixes half of PR10177. The fix to PR10177 exposed a case where template instantiation failed to provide a source location for a diagnostic, so TreeTransform has been tweaked to supply source locations when transforming a type. The source location is still not very good, but MarkDeclarationsReferencedInType would need to operate on a TypeLoc to improve it further. Also fix MarkDeclarationReferenced in C++98 mode to trigger instantiation for static data members of class templates which are used in constant expressions. This fixes a link-time problem, but we still incorrectly treat the member as non-constant. The rest of the fix for that issue is blocked on PCH support for early-instantiated static data members, which will be added in a subsequent patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146955 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark the multiply which occurs as part of performing pointerJohn McCall2011-06-251-2/+2
| | | | | | | | | arithmetic on a VLA as 'nsw', per discussion with djg, and implement pointer arithmetic (other than array accesses) and pointer subtraction for VLA types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133855 91177308-0d34-0410-b5e6-96231b3b80d8
* Change the IR-generation of VLAs so that we capture bounds,John McCall2011-06-241-0/+43
not sizes; so that we use well-typed allocas; and so that we properly recurse through the full set of variably-modified types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133827 91177308-0d34-0410-b5e6-96231b3b80d8