Displaying 20 results from an estimated 8000 matches similar to: "[LLVMdev] memcpy(), memmove(), and memset() with zero length"
2017 Jul 20
2
Which assumptions do llvm.memcpy/memmove/memset.* make when the count is 0?
Hi all,
when I call the llvm.memcpy/memmove/memset.* intrinsics, typically I
have to pass in valid (non-dangling, non-NULL pointers) of the given
alignment. However, to what extent to these rules apply when the count
is 0? Concretely (for any variant of the three aforementioned
intrinsics): Is it UB to call them on a dangling pointer when count is
0? On a pointer of less than the given
2018 Jan 18
0
Change memcpy/memmove/memset to have dest and source alignment attributes
Hi all,
This change has been reviewed, and appears to be ready to land (review available here if anyone still wants to chime in: https://reviews.llvm.org/D41675 ). The process that we’re going to use for landing this will take a few steps. To wit:
Step 1) Remove align argument, and add align attribute to pointer args. Require that src & dest have the same alignment via verifier rule. Also
2018 Apr 02
0
Change memcpy/memmove/memset to have dest and source alignment attributes
Hi Daniel,
a quick question (and kind-of a follow-up to
<https://lists.llvm.org/pipermail/llvm-dev/2017-July/115665.html>): Do the
pointers have to be aligned even if the size is 0? It would be nice to have
this stated explicitly in the LangRef.
Kind regards,
Ralf
On 26.03.2018 22:43, Daniel Neilson via llvm-dev wrote:
> Hi all,
> A quick note just to let people know that as of
2013 Jan 29
0
[LLVMdev] Specify the volatile access behaviour of the memcpy, memmove and memset intrinsics
I can't think of a better way to do this, so I think it's ok.
I also submitted a complementary patch on llvm-commits clarifying volatile semantics.
-Andy
On Jan 28, 2013, at 8:54 AM, Arnaud A. de Grandmaison <arnaud.allarddegrandmaison at parrot.com> wrote:
> Hi All,
>
> In the language reference manual, the access behavior of the memcpy,
> memmove and memset
2018 Mar 26
1
Change memcpy/memmove/memset to have dest and source alignment attributes
Hi all,
A quick note just to let people know that as of this past Friday my go at this work has been fully landed. It ended up being a back-burner item, so it took longer than I would have liked to get completed. None the less, the changes made were:
1) The IRBuilders in LLVM, Clang, and Polly were all updated to create only the new form of the memory intrinsics.
2) All LLVM passes to understand
2013 Jan 31
0
[LLVMdev] Specify the volatile access behaviour of the memcpy, memmove and memset intrinsics
Thanks Andy and Chandler,
After specifying the volatile access behaviour, the second step was to
autoupgrade the memmove/memcpy intrinsics, and implement
(is|set)Volatile in terms of (is|set)(Src|Dest)Volatile, with no
functional change.
0001-Specify-the-access-behaviour-of-the-memcpy-memmove-a.patch is the
one you already reviewed, unaltered.
2013 Feb 03
0
[LLVMdev] Specify the volatile access behaviour of the memcpy, memmove and memset intrinsics
Same patches as before, but 0002-memcpy has been updated to put the
(is|set)SrcVolatile methods to where they logically belong :
MemTransferInst. This makes (is|set)Volatile methods look a bit ugly to
keep compatibility with existing behaviour, but they will hopefully
disappear when all users have moved to the new interface --- in the next
series of patches.
I plan to give a try to phabricator
2018 Jan 02
5
Change memcpy/memmove/memset to have dest and source alignment attributes
Good day all,
I’ve spent a few days resurrecting the circa-2015 work on removing the explicit alignment argument (4th arg) from the @llvm.memcpy/memmove/memset intrinsics in favour of using the alignment attribute on the pointer args of calls to the intrinsic. This work was first proposed back in August 2015 by Lang Hames:
http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html (item
2013 Jan 28
4
[LLVMdev] Specify the volatile access behaviour of the memcpy, memmove and memset intrinsics
Hi All,
In the language reference manual, the access behavior of the memcpy,
memmove and memset intrinsics is not well defined with respect to the
volatile flag. The LRM even states that "it is unwise to depend on it".
This forces optimization passes to be conservatively correct and prevent
optimizations.
A very simple example of this is :
$ cat test.c
#include <stdint.h>
2018 Jan 19
2
Change memcpy/memmove/memset to have dest and source alignment attributes
> On Jan 18, 2018, at 7:45 AM, Daniel Neilson via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
>
> Hi all,
> This change has been reviewed, and appears to be ready to land (review available here if anyone still wants to chime in: https://reviews.llvm.org/D41675 <https://reviews.llvm.org/D41675> ). The process that we’re going to use for landing this will take a few
2007 Oct 07
1
[LLVMdev] malloc(), free(), and alloca() with zero size
Dale Johannesen wrote:
> On Oct 6, 2007, at 9:14 AM, Jon Sargeant wrote:
>
>> If <NumElements> is zero, what is the behavior of malloc() and
>> alloca()?
>> Can I call free() using the pointer that malloc() returns?
>
> alloca is not standard.
> The behavior of malloc is covered in 7.20.3p1:
>
> If the size of the space requested is zero, the
2020 Sep 18
3
GC-parseable element atomic memcpy/memmove
TLDR: a proposal to add GC-parseable lowering to element atomic
memcpy/memmove instrinsics controlled by a new "requires-statepoint”
call attribute.
Currently llvm.{memcpy|memmove}.element.unordered.atomic calls are
considered as GC leaf functions (like most other intrinsics). As a
result GC cannot occur while copy operation is in progress. This might
have negative effect on GC latencies
2014 Dec 06
3
[LLVMdev] Memset/memcpy: user control of loop-idiom recognizer
On Sat, Dec 06, 2014 at 07:06:31AM -0600, Hal Finkel wrote:
> - Direction (should the memory be traversed forward or backward)
I don't think that this makes sense for memset and memcpy. It does
matter for memmove.
Joerg
2011 Apr 14
2
[LLVMdev] llvm instrinsic (memcpy/memset/memmov)and ConstantExpression with cast
Hi All,
I have a question on ConstantExpressions and llvm intrinsic memcpy/memset/memmove. I am using llvm-2.8 release. In one of the C programs that I am compiling using clang frontend, the call to memcpy instrinsic looks like the following
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp2, i8* bitcast (%struct.ta* @tret to i8*), i64 4, i32 4, i1 false), !dbg !19
The second argument to memcpy is
2020 Sep 30
2
GC-parseable element atomic memcpy/memmove
Thanks for the feedback.
I think both of the suggestions are very reasonable. I’ll incorporate them.
Given there were no objections for two weeks, I’m going to go ahead with posting individual patches for review.
One small question inline:
On Sep 28, 2020, at 10:56 AM, Philip Reames <listmail at philipreames.com<mailto:listmail at philipreames.com>> wrote:
In general, I am
2015 Aug 19
3
[RFC] Generalize llvm.memcpy / llvm.memmove intrinsics.
Hi All,
I'd like to float two changes to the llvm.memcpy / llvm.memmove intrinsics.
(1) Add an i1 <mayPerfectlyAlias> argument to the llvm.memcpy intrinsic.
When set to '1' (the auto-upgrade default), this argument would indicate
that the source and destination arguments may perfectly alias (otherwise
they must not alias at all - memcpy prohibits partial overlap). While the C
2017 Jul 21
0
Which assumptions do llvm.memcpy/memmove/memset.* make when the count is 0?
> I don't think that was the conclusion of the discussion? I mean the
> result was that a NULL pointer should be explicitly valid if the length
> argument is zero. That's a bit more restrictive.
Yeah there's a design space here. I don't care about the result but am
volunteering to document whatever people want.
John
2017 Jul 21
3
Which assumptions do llvm.memcpy/memmove/memset.* make when the count is 0?
On Fri, Jul 21, 2017 at 09:31:41AM -0600, John Regehr via llvm-dev wrote:
> I propose documenting in the LangRef that memcpy and related intrinsics are
> defined even when src and dst don't refer to valid storage as long as the
> length argument is zero. Then we commit to implementing that behavior. Is
> that OK with everyone? If so I can update the doc.
I don't think that was
2016 Nov 11
2
RFC: Add atomic versions of the llvm.memcpy, llvm.memmove and llvm.memset intrinsics
Hi,
LLVM's memory intrinsics are quite useful for performing various optimizations
with frequently used memory operations. Unfortunately this intrinsics are not applicable for
languages with guaranteed atomicity for their memory accesses (like Java for example).
In order to overcome this limitation I'm thinking about adding set of intrinsics
which will execute as a series of unordered
2017 Jul 21
2
Which assumptions do llvm.memcpy/memmove/memset.* make when the count is 0?
> So, the pointer arguments of memcpy *shall* (a violation of a shall
> clause is UB, per §4/2) have valid values, even though the function will
> copy zero characters.
This is true in C but the question was about LLVM intrinsics.
Since the LangRef does not mention any such restriction, I would assume
that memcpy(0,0,0) is not UB in LLVM. If it is UB then we must update
the LangRef