Displaying 20 results from an estimated 11000 matches similar to: "llvm.memcpy for struct copy"
2018 Jan 30
0
llvm.memcpy for struct copy
The i8 type in the pointers doesn't matter a whole lot. There's a long term
plan to remove the type from all pointers in llvm IR.
Yes, clang will use memcpy for struct copies. You can see example IR here
https://godbolt.org/g/8gQ18m. You'll see that the struct pointers are
bitcasted to i8* before the call.
~Craig
On Mon, Jan 29, 2018 at 11:12 PM, ma jun via llvm-dev <
llvm-dev at
2018 Jan 30
2
llvm.memcpy for struct copy
Hi
Thanks !
so for this example
void foo(X &src, X &dst) {
dst = src;
}
and the IR:
define void @foo(X&, X&)(%struct.X* dereferenceable(8), %struct.X*
dereferenceable(8)) #0 {
%3 = alloca %struct.X*, align 8
%4 = alloca %struct.X*, align 8
store %struct.X* %0, %struct.X** %3, align 8
store %struct.X* %1, %struct.X** %4, align 8
%5 = load %struct.X*,
2018 Jan 30
2
llvm.memcpy for struct copy
The pointers must always be i8* the alignment is independent and is
controlled by the attributes on the arguments in the call to memcpy.
~Craig
On Mon, Jan 29, 2018 at 11:45 PM, ma jun <jun.parser at gmail.com> wrote:
> Hi
>
>
> 2018-01-30 15:36 GMT+08:00 ma jun <jun.parser at gmail.com>:
>
>> Hi
>> Thanks !
>> so for this example
>>
2018 Jan 30
0
llvm.memcpy for struct copy
Hi
2018-01-30 15:36 GMT+08:00 ma jun <jun.parser at gmail.com>:
> Hi
> Thanks !
> so for this example
> void foo(X &src, X &dst) {
> dst = src;
> }
> and the IR:
>
> define void @foo(X&, X&)(%struct.X* dereferenceable(8), %struct.X*
> dereferenceable(8)) #0 {
> %3 = alloca %struct.X*, align 8
> %4 = alloca %struct.X*,
2018 Jan 30
0
llvm.memcpy for struct copy
Hi Craig
Thank you very much !
2018-01-30 16:11 GMT+08:00 Craig Topper <craig.topper at gmail.com>:
> The pointers must always be i8* the alignment is independent and is
> controlled by the attributes on the arguments in the call to memcpy.
>
> ~Craig
>
> On Mon, Jan 29, 2018 at 11:45 PM, ma jun <jun.parser at gmail.com> wrote:
>
>> Hi
>>
>>
2018 Jan 31
4
llvm.memcpy for struct copy
Hi Ma,
how can I transform the llvm.memcpy into data move loop IR and eliminate
> the bitcast instruction ?
>
I'm not sure why you are concerned about memcpy and bitcasts, but if you
call MCpyInst->getSource() and MCpyInst->getDest() it will look through
casts and give you the 'true' source/destination.
If you want to get rid of memcpy altogether, you can take a look
2019 Jun 05
2
@llvm.memcpy not honoring volatile?
The following IR with the volatile parameter set to true
> call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 %1, i64
7, i1 true)
generates the following asm:
> movl (%rsi), %eax
> movl 3(%rsi), %ecx
> movl %ecx, 3(%rdi)
> movl %eax, (%rdi)
It performs an overlapping read/write which - I believe - is violating the
volatile semantic
Full example here:
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
2019 Jun 04
2
llvm-ir: TBAA and struct copies
Hi,
I have a question about the current definition of TBAA (See [1]).
In the LLVM-IR code that we produce, we generate load/stores of struct types. (See [2] and [3] for a godbolt example showing the issue)
For following c-alike code:
struct S { int dummy; short e, f; } x,y;
struct S* p = &x;
int foobar() {
x.f=42;
*p=y; //**** struct copy
return x.f;
}
We produce:
2018 Jan 30
2
llvm.memcpy for struct copy
Hi all
why does llvm.memcpy only support i8* ? and how does clang transform
struct copy?
Thanks !
Regards
Jun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180130/d2b78ca3/attachment-0001.html>
2019 Jun 05
2
llvm-ir: TBAA and struct copies
Hi Ivan,
The code that we have is indeed different from what the 'standard llvm' expects. Let me explain:
in our version we came into this situation in two steps:
1) I added support for 'special types' that map directly to types supported by hardware.
These types are represented by a struct containing a single iXXX member, providing the necessary bits
of the type, and at the
2018 Nov 23
2
is this a bug in an optimization pass?
The frontend code is a pretty simple for loop, that counts from i = 0;
i != 10; i += 1
It gets optimized into and endless loop.
export fn entry() void {
var array: [10]Bar = undefined;
var x = for (array) |elem, i| {
if (i == 1) break elem;
} else bar2();
}
Here's the generated IR:
; ModuleID = 'test'
source_filename = "test"
target datalayout =
2013 May 21
4
[LLVMdev] malloc / free & memcpy optimisations.
The front end I'm building for an existing interpreted language is
unfortunately producing output similar to this far too often;
define void @foo(i8* nocapture %dest, i8* nocapture %src, i32 %len)
nounwind {
%1 = tail call noalias i8* @malloc(i32 %len) nounwind
tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %1, i8* %src, i32 %len, i32
1, i1 false)
tail call void
2018 Mar 22
2
new @llvm.memcpy and @llvm.memset API in trunk - how to use alignment?
The new @llvm.memcpy API does not have an alignment parameter. Instead the
docs say to use the align <n> attribute. How is this supposed to work with
different alignments?
For example, I have one memcpy with align 4, align 4, and another with
align 1, align 1.
; Function Attrs: argmemonly nounwind
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly align 4,
i8* nocapture
2018 Nov 29
2
AliasAnalysis does not look though a memcpy
Hi,
I'm trying to get AA results for two pointers, but it seems that AA
cannot look though a memcpy. For example:
define dso_local spir_func void @fun() {
entry:
; Store an address of `var'
%var = alloca i32, align 4
store i32 42, i32* %var, align 4
%var.addr = alloca i32*, align 8
store i32* %var, i32** %var.addr, align 8
; Memcpy
2013 May 21
0
[LLVMdev] malloc / free & memcpy optimisations.
> could you allocate the memory on the stack instead (alloca instruction)?
This is mainly for string or binary blob handling, using the stack isn't a
great idea for size reasons.
While I'm experimenting with simple code examples now, and I picked a
simple one for this email. I'm certain things will get much more
complicated once I implement more features of the language.
On Tue,
2018 Mar 22
0
new @llvm.memcpy and @llvm.memset API in trunk - how to use alignment?
On 3/22/2018 3:15 PM, Andrew Kelley via llvm-dev wrote:
> The new @llvm.memcpy API does not have an alignment parameter. Instead
> the docs say to use the align <n> attribute. How is this supposed to
> work with different alignments?
>
> For example, I have one memcpy with align 4, align 4, and another with
> align 1, align 1.
>
> ; Function Attrs: argmemonly
2018 Jan 30
1
Fwd: llvm.memcpy for struct copy
Hi all
why does llvm.memcpy intrinsic only support i8* for first two
arguments? and does clang will also transform struct copy into llvm.memcpy
? what format does IR looks like?
Thanks !
Regards
Jun
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2018 Jan 19
0
Change memcpy/memmove/memset to have dest and source alignment attributes
On Jan 18, 2018, at 10:48 PM, Chris Lattner <clattner at nondot.org<mailto:clattner at nondot.org>> wrote:
On Jan 18, 2018, at 7:45 AM, Daniel Neilson via llvm-dev <llvm-dev at lists.llvm.org<mailto: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:
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