[llvm] 48f4312 - Remove inline gc arguments from statepoints
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 14 19:44:34 PDT 2020
Author: Philip Reames
Date: 2020-08-14T19:44:24-07:00
New Revision: 48f4312d4ec7584059c0ca6171e6d618bedefe5b
URL: https://github.com/llvm/llvm-project/commit/48f4312d4ec7584059c0ca6171e6d618bedefe5b
DIFF: https://github.com/llvm/llvm-project/commit/48f4312d4ec7584059c0ca6171e6d618bedefe5b.diff
LOG: Remove inline gc arguments from statepoints
The "gc-live" operand bundles were recently added, and all tests have been updated to use that format. A migration period was provided, though it's worth noting these intrinsics are experimental, so formally there is no compatibile requirement.
This is an extension to a96fc46. "gc-live" hadn't been implemented at the point that patch was initially posted.
Added:
Modified:
llvm/docs/Statepoints.rst
llvm/lib/IR/Verifier.cpp
llvm/test/Transforms/InstCombine/statepoint-iter.ll
llvm/test/Verifier/statepoint.ll
Removed:
################################################################################
diff --git a/llvm/docs/Statepoints.rst b/llvm/docs/Statepoints.rst
index 49389b6e2685..e857d6f50ba3 100644
--- a/llvm/docs/Statepoints.rst
+++ b/llvm/docs/Statepoints.rst
@@ -449,8 +449,7 @@ Syntax:
func_type <target>,
i64 <#call args>, i64 <flags>,
... (call parameters),
- i64 0, i64 0,
- ... (gc parameters))
+ i64 0, i64 0)
Overview:
"""""""""
@@ -520,15 +519,6 @@ These were originally the length prefixes for 'gc transition parameter' and
entirely replaced with the corresponding operand bundles. In a future
revision, these now redundant arguments will be removed.
-The 'gc parameters' arguments contain every pointer to a garbage
-collector object which potentially needs to be updated by the garbage
-collector. Note that the argument list must explicitly contain a base
-pointer for every derived pointer listed. The order of arguments is
-unimportant. Unlike the other variable length parameter sets, this
-list is not length prefixed. Use of the 'gc parameters' list is
-deprecated and will eventually be replaced entirely with the
-:ref:`gc-live <ob_gc_live>` operand bundle.
-
Semantics:
""""""""""
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 52166a53c6fd..8a12dc5fe51d 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -2136,10 +2136,9 @@ void Verifier::verifyStatepoint(const CallBase &Call) {
Assert(NumDeoptArgs == 0,
"gc.statepoint w/inline deopt operands is deprecated", Call);
- const int ExpectedNumArgs =
- 7 + NumCallArgs + NumTransitionArgs + NumDeoptArgs;
- Assert(ExpectedNumArgs <= (int)Call.arg_size(),
- "gc.statepoint too few arguments according to length fields", Call);
+ const int ExpectedNumArgs = 7 + NumCallArgs;
+ Assert(ExpectedNumArgs == (int)Call.arg_size(),
+ "gc.statepoint too many arguments", Call);
// Check that the only uses of this gc.statepoint are gc.result or
// gc.relocate calls which are tied to this statepoint and thus part
diff --git a/llvm/test/Transforms/InstCombine/statepoint-iter.ll b/llvm/test/Transforms/InstCombine/statepoint-iter.ll
index 72f889a2f97e..53025a472b9f 100644
--- a/llvm/test/Transforms/InstCombine/statepoint-iter.ll
+++ b/llvm/test/Transforms/InstCombine/statepoint-iter.ll
@@ -13,14 +13,14 @@ right:
br label %merge
left:
- %safepoint_token = tail call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0, i32* null)
- %pnew = call i32* @llvm.experimental.gc.relocate.p1i32(token %safepoint_token, i32 7, i32 7)
+ %safepoint_token = tail call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0) ["gc-live" (i32* null)]
+ %pnew = call i32* @llvm.experimental.gc.relocate.p1i32(token %safepoint_token, i32 0, i32 0)
br label %merge
merge:
%pnew_phi = phi i32* [null, %right], [%pnew, %left]
- %safepoint_token2 = tail call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0, i32* %pnew_phi)
- %pnew2 = call i32* @llvm.experimental.gc.relocate.p1i32(token %safepoint_token2, i32 7, i32 7)
+ %safepoint_token2 = tail call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0) ["gc-live" (i32* %pnew_phi)]
+ %pnew2 = call i32* @llvm.experimental.gc.relocate.p1i32(token %safepoint_token2, i32 0, i32 0)
%cmp = icmp eq i32* %pnew2, null
ret i1 %cmp
; CHECK-LABEL: test_null
@@ -37,14 +37,14 @@ right:
br label %merge
left:
- %safepoint_token = tail call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0, i32* undef)
- %pnew = call i32* @llvm.experimental.gc.relocate.p1i32(token %safepoint_token, i32 7, i32 7)
+ %safepoint_token = tail call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0) ["gc-live" (i32* undef)]
+ %pnew = call i32* @llvm.experimental.gc.relocate.p1i32(token %safepoint_token, i32 0, i32 0)
br label %merge
merge:
%pnew_phi = phi i32* [undef, %right], [%pnew, %left]
- %safepoint_token2 = tail call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0, i32* %pnew_phi)
- %pnew2 = call i32* @llvm.experimental.gc.relocate.p1i32(token %safepoint_token2, i32 7, i32 7)
+ %safepoint_token2 = tail call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0) ["gc-live" (i32* %pnew_phi)]
+ %pnew2 = call i32* @llvm.experimental.gc.relocate.p1i32(token %safepoint_token2, i32 0, i32 0)
ret i32* %pnew2
; CHECK-LABEL: test_undef
; CHECK-NOT: %pnew
diff --git a/llvm/test/Verifier/statepoint.ll b/llvm/test/Verifier/statepoint.ll
index 79c11c8e7116..96ab02ff4581 100644
--- a/llvm/test/Verifier/statepoint.ll
+++ b/llvm/test/Verifier/statepoint.ll
@@ -11,11 +11,11 @@ declare i32 @"personality_function"()
define i64 addrspace(1)* @test1(i8 addrspace(1)* %arg) gc "statepoint-example" {
entry:
%cast = bitcast i8 addrspace(1)* %arg to i64 addrspace(1)*
- %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* undef, i32 0, i32 0, i32 0, i32 0, i8 addrspace(1)* %arg, i64 addrspace(1)* %cast, i8 addrspace(1)* %arg, i8 addrspace(1)* %arg) ["deopt" (i32 0, i32 0, i32 0, i32 10, i32 0)]
- %reloc = call i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %safepoint_token, i32 7, i32 8)
+ %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* undef, i32 0, i32 0, i32 0, i32 0) ["gc-live" (i8 addrspace(1)* %arg, i64 addrspace(1)* %cast, i8 addrspace(1)* %arg, i8 addrspace(1)* %arg), "deopt" (i32 0, i32 0, i32 0, i32 10, i32 0)]
+ %reloc = call i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %safepoint_token, i32 0, i32 1)
;; It is perfectly legal to relocate the same value multiple times...
- %reloc2 = call i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %safepoint_token, i32 7, i32 8)
- %reloc3 = call i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %safepoint_token, i32 8, i32 7)
+ %reloc2 = call i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %safepoint_token, i32 0, i32 1)
+ %reloc3 = call i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %safepoint_token, i32 1, i32 0)
ret i64 addrspace(1)* %reloc
; CHECK-LABEL: test1
; CHECK: statepoint
@@ -40,8 +40,8 @@ notequal:
ret void
equal:
- %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* undef, i32 0, i32 0, i32 0, i32 0, i8 addrspace(1)* %arg, i64 addrspace(1)* %cast, i8 addrspace(1)* %arg, i8 addrspace(1)* %arg) ["deopt" (i32 0, i32 0, i32 0, i32 10, i32 0)]
- %reloc = call i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %safepoint_token, i32 7, i32 7)
+ %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* undef, i32 0, i32 0, i32 0, i32 0) ["gc-live" (i8 addrspace(1)* %arg, i64 addrspace(1)* %cast, i8 addrspace(1)* %arg, i8 addrspace(1)* %arg), "deopt" (i32 0, i32 0, i32 0, i32 10, i32 0)]
+ %reloc = call i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %safepoint_token, i32 0, i32 0)
call void undef(i64 addrspace(1)* %reloc)
ret void
; CHECK-LABEL: test2
@@ -58,7 +58,7 @@ define i8 addrspace(1)* @test3(i8 addrspace(1)* %obj, i8 addrspace(1)* %obj1) gc
entry:
; CHECK-LABEL: entry
; CHECK: statepoint
- %0 = invoke token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* undef, i32 0, i32 0, i32 0, i32 0, i8 addrspace(1)* %obj, i8 addrspace(1)* %obj1) ["deopt" (i32 0, i32 -1, i32 0, i32 0, i32 0)]
+ %0 = invoke token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* undef, i32 0, i32 0, i32 0, i32 0) ["gc-live" (i8 addrspace(1)* %obj, i8 addrspace(1)* %obj1), "deopt" (i32 0, i32 -1, i32 0, i32 0, i32 0)]
to label %normal_dest unwind label %exceptional_return
normal_dest:
@@ -66,8 +66,8 @@ normal_dest:
; CHECK: gc.relocate
; CHECK: gc.relocate
; CHECK: ret
- %obj.relocated = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %0, i32 7, i32 7)
- %obj1.relocated = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %0, i32 8, i32 8)
+ %obj.relocated = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %0, i32 0, i32 0)
+ %obj1.relocated = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %0, i32 1, i32 1)
ret i8 addrspace(1)* %obj.relocated
exceptional_return:
@@ -76,8 +76,8 @@ exceptional_return:
; CHECK: gc.relocate
%landing_pad = landingpad token
cleanup
- %obj.relocated1 = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %landing_pad, i32 7, i32 7)
- %obj1.relocated1 = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %landing_pad, i32 8, i32 8)
+ %obj.relocated1 = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %landing_pad, i32 0, i32 0)
+ %obj1.relocated1 = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %landing_pad, i32 1, i32 1)
ret i8 addrspace(1)* %obj1.relocated1
}
More information about the llvm-commits
mailing list