1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[Statepoint] Remove code related to inline operand bundles

This code becomes dead for valid IR after 48f4312 and a96fc46.  The reason for the test change is that the verifier reports the first verification error encountered, in some non-specified visit order.  By removing the verification code in gc.relocates for a statepoint with inline gc operands, I change the error the verifier reports.  And in one case, the checked for error is no longer possible with the bundle representation, so I simply delete the file.
This commit is contained in:
Philip Reames 2020-08-14 20:29:41 -07:00
parent 87fc3812c0
commit bc40b4f222
4 changed files with 11 additions and 106 deletions

View File

@ -136,7 +136,7 @@ public:
/// Return an end iterator of the arguments to the underlying call
const_op_iterator actual_arg_end() const {
auto I = actual_arg_begin() + actual_arg_size();
assert((arg_end() - I) >= 0);
assert((arg_end() - I) == 2);
return I;
}
/// range adapter for actual call arguments
@ -147,16 +147,12 @@ public:
const_op_iterator gc_transition_args_begin() const {
if (auto Opt = getOperandBundle(LLVMContext::OB_gc_transition))
return Opt->Inputs.begin();
auto I = actual_arg_end() + 1;
assert((arg_end() - I) >= 0);
return I;
return arg_end();
}
const_op_iterator gc_transition_args_end() const {
if (auto Opt = getOperandBundle(LLVMContext::OB_gc_transition))
return Opt->Inputs.end();
auto I = gc_transition_args_begin() + getNumDeoptArgs();
assert((arg_end() - I) >= 0);
return I;
return arg_end();
}
/// range adapter for GC transition arguments
@ -167,19 +163,12 @@ public:
const_op_iterator deopt_begin() const {
if (auto Opt = getOperandBundle(LLVMContext::OB_deopt))
return Opt->Inputs.begin();
// The current format has two length prefix bundles between call args and
// start of gc args. This will be removed in the near future.
uint64_t NumTrans = getNumGCTransitionArgs();
const_op_iterator I = actual_arg_end() + 2 + NumTrans;
assert((arg_end() - I) >= 0);
return I;
return arg_end();
}
const_op_iterator deopt_end() const {
if (auto Opt = getOperandBundle(LLVMContext::OB_deopt))
return Opt->Inputs.end();
auto I = deopt_begin() + getNumDeoptArgs();
assert((arg_end() - I) >= 0);
return I;
return arg_end();
}
/// range adapter for vm state arguments
@ -192,30 +181,16 @@ public:
const_op_iterator gc_args_begin() const {
if (auto Opt = getOperandBundle(LLVMContext::OB_gc_live))
return Opt->Inputs.begin();
// The current format has two length prefix bundles between call args and
// start of gc args. This will be removed in the near future.
uint64_t NumTrans = getNumGCTransitionArgs();
uint64_t NumDeopt = getNumDeoptArgs();
auto I = actual_arg_end() + 2 + NumTrans + NumDeopt;
assert((arg_end() - I) >= 0);
return I;
return arg_end();
}
/// Return an end iterator for the gc argument range
const_op_iterator gc_args_end() const {
if (auto Opt = getOperandBundle(LLVMContext::OB_gc_live))
return Opt->Inputs.end();
return arg_end();
}
/// Return the operand index at which the gc args begin
unsigned gcArgsStartIdx() const {
assert(!getOperandBundle(LLVMContext::OB_gc_live));
return gc_args_begin() - op_begin();
}
/// range adapter for gc arguments
iterator_range<const_op_iterator> gc_args() const {
return make_range(gc_args_begin(), gc_args_end());
@ -236,19 +211,6 @@ public:
return GRI;
return nullptr;
}
private:
int getNumGCTransitionArgs() const {
const Value *NumGCTransitionArgs = *actual_arg_end();
return cast<ConstantInt>(NumGCTransitionArgs)->getZExtValue();
}
int getNumDeoptArgs() const {
uint64_t NumTrans = getNumGCTransitionArgs();
const_op_iterator trans_end = actual_arg_end() + 1 + NumTrans;
const Value *NumDeoptArgs = *trans_end;
return cast<ConstantInt>(NumDeoptArgs)->getZExtValue();
}
};
/// Common base class for representing values projected from a statepoint.

View File

@ -4802,45 +4802,6 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
"gc.relocate: statepoint base index out of bounds", Call);
Assert(DerivedIndex < Opt->Inputs.size(),
"gc.relocate: statepoint derived index out of bounds", Call);
} else {
Assert(BaseIndex < StatepointCall.arg_size(),
"gc.relocate: statepoint base index out of bounds", Call);
Assert(DerivedIndex < StatepointCall.arg_size(),
"gc.relocate: statepoint derived index out of bounds", Call);
// Check that BaseIndex and DerivedIndex fall within the 'gc parameters'
// section of the statepoint's argument.
Assert(StatepointCall.arg_size() > 0,
"gc.statepoint: insufficient arguments");
Assert(isa<ConstantInt>(StatepointCall.getArgOperand(3)),
"gc.statement: number of call arguments must be constant integer");
const uint64_t NumCallArgs =
cast<ConstantInt>(StatepointCall.getArgOperand(3))->getZExtValue();
Assert(StatepointCall.arg_size() > NumCallArgs + 5,
"gc.statepoint: mismatch in number of call arguments");
Assert(isa<ConstantInt>(StatepointCall.getArgOperand(NumCallArgs + 5)),
"gc.statepoint: number of transition arguments must be "
"a constant integer");
const uint64_t NumTransitionArgs =
cast<ConstantInt>(StatepointCall.getArgOperand(NumCallArgs + 5))
->getZExtValue();
const uint64_t DeoptArgsStart = 4 + NumCallArgs + 1 + NumTransitionArgs + 1;
Assert(isa<ConstantInt>(StatepointCall.getArgOperand(DeoptArgsStart)),
"gc.statepoint: number of deoptimization arguments must be "
"a constant integer");
const uint64_t NumDeoptArgs =
cast<ConstantInt>(StatepointCall.getArgOperand(DeoptArgsStart))
->getZExtValue();
const uint64_t GCParamArgsStart = DeoptArgsStart + 1 + NumDeoptArgs;
const uint64_t GCParamArgsEnd = StatepointCall.arg_size();
Assert(GCParamArgsStart <= BaseIndex && BaseIndex < GCParamArgsEnd,
"gc.relocate: statepoint base index doesn't fall within the "
"'gc parameters' section of the statepoint call",
Call);
Assert(GCParamArgsStart <= DerivedIndex && DerivedIndex < GCParamArgsEnd,
"gc.relocate: statepoint derived index doesn't fall within the "
"'gc parameters' section of the statepoint call",
Call);
}
// Relocated value must be either a pointer type or vector-of-pointer type,

View File

@ -1,6 +1,6 @@
; RUN: not opt -verify 2>&1 < %s | FileCheck %s
; CHECK: gc.statepoint: mismatch in number of call arguments
; CHECK: gc.statepoint mismatch in number of call args
declare zeroext i1 @return0i1()
@ -10,11 +10,11 @@ declare token @llvm.experimental.gc.statepoint.p0f0i1f(i64, i32, i1 ()*, i32, i3
; Function Attrs: nounwind
declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token, i32, i32) #0
define i32 addrspace(1)* @0(i32 addrspace(1)* %dparam) {
define i32 addrspace(1)* @0(i32 addrspace(1)* %dparam) gc "statepoint-example" {
%a00 = load i32, i32 addrspace(1)* %dparam
%to0 = call token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f0i1f(i64 0, i32 0, i1 ()* @return0i1, i32 9, i32 0, i2 0, i32 addrspace(1)* %dparam)
%relocate = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %to0, i32 2, i32 6)
%to0 = call token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f0i1f(i64 0, i32 0, i1 ()* @return0i1, i32 9, i32 0, i2 0) ["gc-live" (i32 addrspace(1)* %dparam)]
%relocate = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %to0, i32 0, i32 0)
ret i32 addrspace(1)* %relocate
}
attributes #0 = { nounwind }
attributes #0 = { nounwind }

View File

@ -1,18 +0,0 @@
; RUN: not opt -S < %s -verify 2>&1 | FileCheck %s
; CHECK: gc.statepoint: number of deoptimization arguments must be a constant integer
declare void @use(...)
declare i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token, i32, i32)
declare i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token, i32, i32)
declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)
declare i32 @"personality_function"()
;; Basic usage
define i64 addrspace(1)* @test1(i8 addrspace(1)* %arg, i32 %val) 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 %val, i32 0, i32 0, i32 0, i32 10, i32 0, i8 addrspace(1)* %arg, i64 addrspace(1)* %cast, i8 addrspace(1)* %arg, i8 addrspace(1)* %arg)
%reloc = call i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %safepoint_token, i32 12, i32 13)
ret i64 addrspace(1)* %reloc
}