Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set IL offsets for calls created during devirtualization #61189

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6144,10 +6144,10 @@ class Compiler
#endif

public:
Statement* fgNewStmtAtBeg(BasicBlock* block, GenTree* tree);
Statement* fgNewStmtAtBeg(BasicBlock* block, GenTree* tree, IL_OFFSETX offs = BAD_IL_OFFSET);
void fgInsertStmtAtEnd(BasicBlock* block, Statement* stmt);
Statement* fgNewStmtAtEnd(BasicBlock* block, GenTree* tree);
Statement* fgNewStmtNearEnd(BasicBlock* block, GenTree* tree);
Statement* fgNewStmtAtEnd(BasicBlock* block, GenTree* tree, IL_OFFSETX offs = BAD_IL_OFFSET);
Statement* fgNewStmtNearEnd(BasicBlock* block, GenTree* tree, IL_OFFSETX offs = BAD_IL_OFFSET);

private:
void fgInsertStmtNearEnd(BasicBlock* block, Statement* stmt);
Expand Down
14 changes: 8 additions & 6 deletions src/coreclr/jit/fgstmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@ void Compiler::fgInsertStmtAtBeg(BasicBlock* block, Statement* stmt)
// Arguments:
// block - the block into which 'tree' will be inserted;
// tree - the tree to be inserted.
// offs - the offset to use for the statement
//
// Return Value:
// The new created statement with `tree` inserted into `block`.
//
Statement* Compiler::fgNewStmtAtBeg(BasicBlock* block, GenTree* tree)
Statement* Compiler::fgNewStmtAtBeg(BasicBlock* block, GenTree* tree, IL_OFFSETX offs)
{
Statement* stmt = gtNewStmt(tree);
Statement* stmt = gtNewStmt(tree, offs);
fgInsertStmtAtBeg(block, stmt);
return stmt;
}
Expand Down Expand Up @@ -153,16 +154,17 @@ void Compiler::fgInsertStmtAtEnd(BasicBlock* block, Statement* stmt)
// Arguments:
// block - the block into which 'stmt' will be inserted;
// tree - the tree to be inserted.
// offs - the offset to use for the statement
//
// Return Value:
// The new created statement with `tree` inserted into `block`.
//
// Note:
// If the block can be a conditional block, use fgNewStmtNearEnd.
//
Statement* Compiler::fgNewStmtAtEnd(BasicBlock* block, GenTree* tree)
Statement* Compiler::fgNewStmtAtEnd(BasicBlock* block, GenTree* tree, IL_OFFSETX offs)
{
Statement* stmt = gtNewStmt(tree);
Statement* stmt = gtNewStmt(tree, offs);
fgInsertStmtAtEnd(block, stmt);
return stmt;
}
Expand Down Expand Up @@ -245,9 +247,9 @@ void Compiler::fgInsertStmtNearEnd(BasicBlock* block, Statement* stmt)
// Return Value:
// The new created statement with `tree` inserted into `block`.
//
Statement* Compiler::fgNewStmtNearEnd(BasicBlock* block, GenTree* tree)
Statement* Compiler::fgNewStmtNearEnd(BasicBlock* block, GenTree* tree, IL_OFFSETX offs)
{
Statement* stmt = gtNewStmt(tree);
Statement* stmt = gtNewStmt(tree, offs);
fgInsertStmtNearEnd(block, stmt);
return stmt;
}
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/jit/indirectcalltransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,14 +781,14 @@ class IndirectCallTransformer
}
else
{
compiler->fgNewStmtAtEnd(thenBlock, call);
compiler->fgNewStmtAtEnd(thenBlock, call, stmt->GetILOffsetX());
}
}
else
{
// Add the call.
//
compiler->fgNewStmtAtEnd(thenBlock, call);
compiler->fgNewStmtAtEnd(thenBlock, call, stmt->GetILOffsetX());

// Re-establish this call as an inline candidate.
//
Expand Down Expand Up @@ -831,7 +831,7 @@ class IndirectCallTransformer
elseBlock = CreateAndInsertBasicBlock(BBJ_NONE, thenBlock);
elseBlock->bbFlags |= currBlock->bbFlags & BBF_SPLIT_GAINED;
GenTreeCall* call = origCall;
Statement* newStmt = compiler->gtNewStmt(call);
Statement* newStmt = compiler->gtNewStmt(call, stmt->GetILOffsetX());

call->gtFlags &= ~GTF_CALL_INLINE_CANDIDATE;
call->SetIsGuarded();
Expand Down