[llvm] r326433 - [CodeGen] fix argument attribute in lowering statepoint/patchpoint

Than McIntosh via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 05:31:58 PST 2018


Author: thanm
Date: Thu Mar  1 05:31:57 2018
New Revision: 326433

URL: http://llvm.org/viewvc/llvm-project?rev=326433&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    llvm/trunk/test/CodeGen/X86/patchpoint.ll
    llvm/trunk/test/CodeGen/X86/statepoint-call-lowering.ll

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=326433&r1=326432&r2=326433&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Thu Mar  1 05:31:57 2018
@@ -702,7 +702,7 @@ bool FastISel::lowerCallOperands(const C
     ArgListEntry Entry;
     Entry.Val = V;
     Entry.Ty = V->getType();
-    Entry.setAttributes(&CS, ArgIdx);
+    Entry.setAttributes(&CS, ArgI);
     Args.push_back(Entry);
   }
 

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=326433&r1=326432&r2=326433&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Mar  1 05:31:57 2018
@@ -7700,7 +7700,7 @@ void SelectionDAGBuilder::populateCallLo
     TargetLowering::ArgListEntry Entry;
     Entry.Node = getValue(V);
     Entry.Ty = V->getType();
-    Entry.setAttributes(&CS, ArgIdx);
+    Entry.setAttributes(&CS, ArgI);
     Args.push_back(Entry);
   }
 

Modified: llvm/trunk/test/CodeGen/X86/patchpoint.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/patchpoint.ll?rev=326433&r1=326432&r2=326433&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/patchpoint.ll (original)
+++ llvm/trunk/test/CodeGen/X86/patchpoint.ll Thu Mar  1 05:31:57 2018
@@ -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, ...)

Modified: llvm/trunk/test/CodeGen/X86/statepoint-call-lowering.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/statepoint-call-lowering.ll?rev=326433&r1=326432&r2=326433&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/statepoint-call-lowering.ll (original)
+++ llvm/trunk/test/CodeGen/X86/statepoint-call-lowering.ll Thu Mar  1 05:31:57 2018
@@ -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.re
 
 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)




More information about the llvm-commits mailing list