summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2018-03-01 13:31:57 +0000
committerThan McIntosh <thanm@google.com>2018-03-01 13:31:57 +0000
commitb3d88a7466d1d702f2fb5250ab0b0bda2ea59892 (patch)
tree5bc54202827b1732a0281fa12eece0c2e5654bff
parentd49e75afbdad10e86ef5bfb6d53b86e2f7c63e50 (diff)
downloadbcm5719-llvm-b3d88a7466d1d702f2fb5250ab0b0bda2ea59892.tar.gz
bcm5719-llvm-b3d88a7466d1d702f2fb5250ab0b0bda2ea59892.zip
[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
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FastISel.cpp2
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp2
-rw-r--r--llvm/test/CodeGen/X86/patchpoint.ll15
-rw-r--r--llvm/test/CodeGen/X86/statepoint-call-lowering.ll21
4 files changed, 38 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index bc961386e6d..0a420ae0145 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -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);
}
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 0da491039fd..66cc268aaed 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -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);
}
diff --git a/llvm/test/CodeGen/X86/patchpoint.ll b/llvm/test/CodeGen/X86/patchpoint.ll
index 82b15c36c2b..e8b75ba0d50 100644
--- a/llvm/test/CodeGen/X86/patchpoint.ll
+++ b/llvm/test/CodeGen/X86/patchpoint.ll
@@ -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, ...)
diff --git a/llvm/test/CodeGen/X86/statepoint-call-lowering.ll b/llvm/test/CodeGen/X86/statepoint-call-lowering.ll
index bd2dd53b654..1ad35f340be 100644
--- a/llvm/test/CodeGen/X86/statepoint-call-lowering.ll
+++ b/llvm/test/CodeGen/X86/statepoint-call-lowering.ll
@@ -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)
OpenPOWER on IntegriCloud