Skip to content

llc lowers intrinsics incorrectly with the presense of regparm attribute #4369

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link 3997
Resolution FIXED
Resolved on Mar 20, 2017 13:45
Version trunk
OS Linux
Blocks llvm/llvm-bugzilla-archive#4068
Attachments test case
Reporter LLVM Bugzilla Contributor
CC @asl,@chandlerc,@pageexec

Extended Description

llc does not handle this case correctly:

call void @​llvm.memcpy.i32(i8* %3, i8* %4, i32 2052, i32 4)
%dst1 = bitcast [128 x i8]* %dst to i8*		; <i8*> [#uses=1]
%src2 = bitcast [128 x i8]* %src to i8*		; <i8*> [#uses=1]
%5 = call i8* @&#8203;memcpy(i8* inreg %dst1, i8* inreg %src2, i32 inreg 128) nounwind		; <i8*> [#uses=0]

when llvm.memcpy.i32 lowers to call to memcpy, it does not follow the customized memcpy calling convention.

for the first llvm.memcpy.i32, the generated assemblies are:

movl	%eax, (%edx)
movl	%ecx, 4(%edx)
movl	$2052, 8(%edx)
call	memcpy

for the second call of memcpy, the codes are:

leal	-140(%ebp), %eax
leal	-268(%ebp), %ecx
movl	$128, %edx
movl	%edx, -276(%ebp)
movl	%ecx, %edx
movl	-276(%ebp), %ecx
call	memcpy

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions