summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/builtin-memfns.c
Commit message (Collapse)AuthorAgeFilesLines
* [Builtins] Teach Clang about memccpyDávid Bolvanský2019-10-281-0/+7
| | | | | | | | | | | | | | Summary: Hopefully, -fno-builtin-memccpy will work now. Required for https://reviews.llvm.org/D67986. Reviewers: aaron.ballman, rsmith Reviewed By: aaron.ballman Subscribers: RKSimon, kristina, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68377
* [constexpr] Fix ICE when memcpy() is given a pointer to an incomplete arrayPetr Pavlu2018-10-041-0/+7
| | | | | | | | | | Fix code for constant evaluation of __builtin_memcpy() and __builtin_memmove() that would attempt to divide by zero when given two pointers to an incomplete array. Differential Revision: https://reviews.llvm.org/D51855 llvm-svn: 343761
* [constexpr] Support for constant evaluation of __builtin_memcpy andRichard Smith2018-08-041-0/+28
| | | | | | | | | | | | | | | | | | __builtin_memmove (in non-type-punning cases). This is intended to permit libc++ to make std::copy etc constexpr without sacrificing the optimization that uses memcpy on trivially-copyable types. __builtin_strcpy and __builtin_wcscpy are not handled by this change. They'd be straightforward to add, but we haven't encountered a need for them just yet. This reinstates r338455, reverted in r338602, with a fix to avoid trying to constant-evaluate a memcpy call if either pointer operand has an invalid designator. llvm-svn: 338941
* Revert r338455 "[constexpr] Support for constant evaluation of ↵Hans Wennborg2018-08-011-17/+0
| | | | | | | | | | | | | | | | __builtin_memcpy and __builtin_memmove (in non-type-punning cases)." It caused asserts during Chromium builds, see reply on the cfe-commits thread. > This is intended to permit libc++ to make std::copy etc constexpr > without sacrificing the optimization that uses memcpy on > trivially-copyable types. > > __builtin_strcpy and __builtin_wcscpy are not handled by this change. > They'd be straightforward to add, but we haven't encountered a need for > them just yet. llvm-svn: 338602
* [constexpr] Support for constant evaluation of __builtin_memcpy andRichard Smith2018-07-311-0/+17
| | | | | | | | | | | | | | __builtin_memmove (in non-type-punning cases). This is intended to permit libc++ to make std::copy etc constexpr without sacrificing the optimization that uses memcpy on trivially-copyable types. __builtin_strcpy and __builtin_wcscpy are not handled by this change. They'd be straightforward to add, but we haven't encountered a need for them just yet. llvm-svn: 338455
* Change memcpy/memove/memset to have dest and source alignment attributes.Daniel Neilson2018-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change is step three in the series of changes to remove alignment argument from memcpy/memmove/memset in favour of alignment attributes. Steps: Step 1) Remove alignment parameter and create alignment parameter attributes for memcpy/memmove/memset. ( rL322965, rC322964, rL322963 ) Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing source and dest alignments. ( rL323597 ) Step 3) Update Clang to use the new IRBuilder API. Step 4) Update Polly to use the new IRBuilder API. Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API, and those that use use MemIntrinsicInst::[get|set]Alignment() to use getDestAlignment() and getSourceAlignment() instead. Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the MemIntrinsicInst::[get|set]Alignment() methods. Reference http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html Reviewers: rjmccall Subscribers: jyknight, nemanjai, nhaehnle, javed.absar, sbc100, aheejin, kbarton, fedor.sergeev, cfe-commits Differential Revision: https://reviews.llvm.org/D41677 llvm-svn: 323617
* Change memcpy/memove/memset to have dest and source alignment attributes ↵Daniel Neilson2018-01-191-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | (Step 1). Summary: Upstream LLVM is changing the the prototypes of the @llvm.memcpy/memmove/memset intrinsics. This change updates the Clang tests for this change. The @llvm.memcpy/memmove/memset intrinsics currently have an explicit argument which is required to be a constant integer. It represents the alignment of the dest (and source), and so must be the minimum of the actual alignment of the two. This change removes the alignment argument in favour of placing the alignment attribute on the source and destination pointers of the memory intrinsic call. For example, code which used to read: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 100, i32 4, i1 false) will now read call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %dest, i8* align 4 %src, i32 100, i1 false) At this time the source and destination alignments must be the same (Step 1). Step 2 of the change, to be landed shortly, will relax that contraint and allow the source and destination to have different alignments. llvm-svn: 322964
* Revert "Change memcpy/memset/memmove to have dest and source alignments."Pete Cooper2015-11-191-6/+6
| | | | | | | | | | This reverts commit r253512. This likely broke the bots in: http://lab.llvm.org:8011/builders/clang-ppc64-elf-linux2/builds/20202 http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/3787 llvm-svn: 253542
* Change memcpy/memset/memmove to have dest and source alignments.Pete Cooper2015-11-181-6/+6
| | | | | | | | | | | | | | | | | | | | | | This is a follow on from a similar LLVM commit: r253511. Note, this was reviewed (and more details are in) http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html These intrinsics currently have an explicit alignment argument which is required to be a constant integer. It represents the alignment of the source and dest, and so must be the minimum of those. This change allows source and dest to each have their own alignments by using the alignment attribute on their arguments. The alignment argument itself is removed. The only code change to clang is hidden in CGBuilder.h which now passes both dest and source alignment to IRBuilder, instead of taking the minimum of dest and source alignments. Reviewed by Hal Finkel. llvm-svn: 253512
* Use the alignment from lvalue emission to more accurately compute the alignmentEli Friedman2012-08-231-0/+20
| | | | | | | of a pointer for builtin emission, instead of just depending on the type of the pointee. <rdar://problem/11314941>. llvm-svn: 162425
* From his comment in PR12168, Eli seems confused about the alignment assumptionsChris Lattner2012-03-041-1/+5
| | | | | | | we're making. We only ignore implicit casts. Add a testcase showing that we get the right behavior with explicit casts. llvm-svn: 151994
* add a testcase for PR12094 and fix a crash on pointer to incomplete type,Chris Lattner2012-03-041-0/+11
| | | | | | reported by Richard Smith. llvm-svn: 151993
* fix a crash on code that uses the result value of __builtin___memcpy_chk.Chris Lattner2011-04-201-0/+6
| | | | llvm-svn: 129892
* fold memcpy/set/move_chk to llvm.memcpy/set/move when the sizesChris Lattner2011-04-171-1/+28
| | | | | | | | | are trivial. This exposes opportunities earlier, and allows fastisel to do good things with these at -O0. This addresses rdar://9289468 - clang doesn't fold memset_chk at -O0 llvm-svn: 129651
* Reapply patch for adding support for address spaces and added a isVolatile ↵Mon P Wang2010-04-041-5/+7
| | | | | | field to memcpy, memmove, and memset. llvm-svn: 100305
* Revert r100193 since it causes failures in objc in clangMon P Wang2010-04-021-7/+5
| | | | llvm-svn: 100200
* Reapply patch for adding support for address spaces and added a isVolatile ↵Mon P Wang2010-04-021-5/+7
| | | | | | field to memcpy, memmove, and memset. llvm-svn: 100193
* Revert Mon Ping's 99930 due to broken llvm-gcc buildbots.Bob Wilson2010-03-301-7/+5
| | | | llvm-svn: 99949
* Added support for address spaces and added a isVolatile field to memcpy, ↵Mon P Wang2010-03-301-5/+7
| | | | | | memmove, and memset llvm-svn: 99930
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Eliminate &&s in tests.Daniel Dunbar2009-11-081-4/+4
| | | | | | - 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious. llvm-svn: 86430
* Remove the -arch option from clang-cc: for all practical purposes, it's Eli Friedman2009-05-191-1/+1
| | | | | | redundant with -triple. llvm-svn: 72108
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Fix IRgen of __builtin_memset.Daniel Dunbar2009-02-161-1/+5
| | | | | | - Fix test case to not only have negative tests. llvm-svn: 64674
* Implement bzero, memset, memmove builtins.Daniel Dunbar2008-07-221-0/+11
This subsumes Nico Weber's patch and implements bzero in terms of llvm.memset to match llvm-gcc. llvm-svn: 53888
OpenPOWER on IntegriCloud