[llvm] r250491 - [RS4GC] Dont' propagate call attrs related to patchable statepoints

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 15 19:41:33 PDT 2015


Author: sanjoy
Date: Thu Oct 15 21:41:23 2015
New Revision: 250491

URL: http://llvm.org/viewvc/llvm-project?rev=250491&view=rev
Log:
[RS4GC] Dont' propagate call attrs related to patchable statepoints

The `"statepoint-id"` and `"statepoint-num-patch-bytes"` attributes are
used solely to determine properties of the `gc.statepoint` being
created.  Once the `gc.statepoint` is in place, these should be removed.

Added:
    llvm/trunk/test/Transforms/RewriteStatepointsForGC/deopt-bundles/patchable-statepoints.ll
Modified:
    llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp?rev=250491&r1=250490&r2=250491&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp Thu Oct 15 21:41:23 2015
@@ -1290,6 +1290,13 @@ static AttributeSet legalizeCallAttribut
             Attr.hasAttribute(Attribute::ReadOnly))
           continue;
 
+        // These attributes control the generation of the gc.statepoint call /
+        // invoke itself; and once the gc.statepoint is in place, they're of no
+        // use.
+        if (Attr.hasAttribute("statepoint-num-patch-bytes") ||
+            Attr.hasAttribute("statepoint-id"))
+          continue;
+
         Ret = Ret.addAttributes(
             AS.getContext(), Index,
             AttributeSet::get(AS.getContext(), Index, AttrBuilder(Attr)));

Added: llvm/trunk/test/Transforms/RewriteStatepointsForGC/deopt-bundles/patchable-statepoints.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/RewriteStatepointsForGC/deopt-bundles/patchable-statepoints.ll?rev=250491&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/RewriteStatepointsForGC/deopt-bundles/patchable-statepoints.ll (added)
+++ llvm/trunk/test/Transforms/RewriteStatepointsForGC/deopt-bundles/patchable-statepoints.ll Thu Oct 15 21:41:23 2015
@@ -0,0 +1,44 @@
+; RUN: opt -S -rewrite-statepoints-for-gc -rs4gc-use-deopt-bundles < %s | FileCheck %s
+
+declare void @f()
+declare i32 @personality_function()
+
+define void @test_id() gc "statepoint-example" personality i32 ()* @personality_function {
+; CHECK-LABEL: @test_id(
+entry:
+; CHECK-LABEL: entry:
+; CHECK: invoke i32 (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 100, i32 0, void ()* @f
+  invoke void @f()  "statepoint-id"="100" to label %normal_return unwind label %exceptional_return
+
+normal_return:
+  ret void
+
+exceptional_return:
+  %landing_pad4 = landingpad {i8*, i32} cleanup
+  ret void
+}
+
+define void @test_num_patch_bytes() gc "statepoint-example" personality i32 ()* @personality_function {
+; CHECK-LABEL: @test_num_patch_bytes(
+entry:
+; CHECK-LABEL: entry:
+; CHECK: invoke i32 (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 99, void ()* @f,
+  invoke void @f()  "statepoint-num-patch-bytes"="99" to label %normal_return unwind label %exceptional_return
+
+normal_return:
+  ret void
+
+exceptional_return:
+  %landing_pad4 = landingpad {i8*, i32} cleanup
+  ret void
+}
+
+declare void @do_safepoint()
+define void @gc.safepoint_poll() {
+entry:
+  call void @do_safepoint()
+  ret void
+}
+
+; CHECK-NOT: statepoint-id
+; CHECK-NOT: statepoint-num-patch_bytes




More information about the llvm-commits mailing list