forked from OSchip/llvm-project
[CodeGen] fix argument attribute in lowering statepoint/patchpoint
Summary: Use the correct loop index varaible, ArgI, to retrieve attributes. Reviewers: thanm, sanjoy, rnk Reviewed By: rnk Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D43832 llvm-svn: 326433
This commit is contained in:
parent
d49e75afbd
commit
b3d88a7466
|
@ -702,7 +702,7 @@ bool FastISel::lowerCallOperands(const CallInst *CI, unsigned ArgIdx,
|
|||
ArgListEntry Entry;
|
||||
Entry.Val = V;
|
||||
Entry.Ty = V->getType();
|
||||
Entry.setAttributes(&CS, ArgIdx);
|
||||
Entry.setAttributes(&CS, ArgI);
|
||||
Args.push_back(Entry);
|
||||
}
|
||||
|
||||
|
|
|
@ -7700,7 +7700,7 @@ void SelectionDAGBuilder::populateCallLoweringInfo(
|
|||
TargetLowering::ArgListEntry Entry;
|
||||
Entry.Node = getValue(V);
|
||||
Entry.Ty = V->getType();
|
||||
Entry.setAttributes(&CS, ArgIdx);
|
||||
Entry.setAttributes(&CS, ArgI);
|
||||
Args.push_back(Entry);
|
||||
}
|
||||
|
||||
|
|
|
@ -98,6 +98,21 @@ entry:
|
|||
ret i64 %result
|
||||
}
|
||||
|
||||
declare i64 @consume_attributes(i64, i8* nest, i64)
|
||||
define i64 @test_patchpoint_with_attributes() {
|
||||
entry:
|
||||
; CHECK-LABEL: test_patchpoint_with_attributes:
|
||||
; CHECK: movl $42, %edi
|
||||
; CHECK: xorl %r10d, %r10d
|
||||
; CHECK: movl $17, %esi
|
||||
; CHECK: movabsq $_consume_attributes, %r11
|
||||
; CHECK-NEXT: callq *%r11
|
||||
; CHECK-NEXT: xchgw %ax, %ax
|
||||
; CHECK: retq
|
||||
%result = tail call i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 21, i32 15, i8* bitcast (i64 (i64, i8*, i64)* @consume_attributes to i8*), i32 3, i64 42, i8* nest null, i64 17)
|
||||
ret i64 %result
|
||||
}
|
||||
|
||||
declare void @llvm.experimental.stackmap(i64, i32, ...)
|
||||
declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...)
|
||||
declare i64 @llvm.experimental.patchpoint.i64(i64, i32, i8*, i32, ...)
|
||||
|
|
|
@ -139,6 +139,25 @@ right:
|
|||
ret i1 true
|
||||
}
|
||||
|
||||
%struct2 = type { i64, i64, i64 }
|
||||
|
||||
declare void @consume_attributes(i32, i8* nest, i32, %struct2* byval)
|
||||
|
||||
define void @test_attributes(%struct2* byval %s) gc "statepoint-example" {
|
||||
entry:
|
||||
; CHECK-LABEL: test_attributes
|
||||
; Check that arguments with attributes are lowered correctly.
|
||||
; We call a function that has a nest argument and a byval argument.
|
||||
; CHECK: movl $42, %edi
|
||||
; CHECK: xorl %r10d, %r10d
|
||||
; CHECK: movl $17, %esi
|
||||
; CHECK: pushq
|
||||
; CHECK: pushq
|
||||
; CHECK: pushq
|
||||
; CHECK: callq consume_attributes
|
||||
%statepoint_token = call token (i64, i32, void (i32, i8*, i32, %struct2*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidi32p0i8i32p0s_struct2sf(i64 0, i32 0, void (i32, i8*, i32, %struct2*)* @consume_attributes, i32 4, i32 0, i32 42, i8* nest null, i32 17, %struct2* byval %s, i32 0, i32 0)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare token @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...)
|
||||
declare i1 @llvm.experimental.gc.result.i1(token)
|
||||
|
@ -157,4 +176,6 @@ declare %struct @llvm.experimental.gc.result.struct(token)
|
|||
|
||||
declare token @llvm.experimental.gc.statepoint.p0f_isVoidi32varargf(i64, i32, void (i32, ...)*, i32, i32, ...)
|
||||
|
||||
declare token @llvm.experimental.gc.statepoint.p0f_isVoidi32p0i8i32p0s_struct2sf(i64, i32, void (i32, i8*, i32, %struct2*)*, i32, i32, ...)
|
||||
|
||||
declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token, i32, i32)
|
||||
|
|
Loading…
Reference in New Issue