Skip to content

Commit b567c5b

Browse files
authored
JIT: Clean up and optimize call arg lowering (#112639)
* Simplify the logic to be based purely off of new ABI info * Consistently insert bitcast nodes for register file mismatches when creating `PUTARG_REG` nodes and for `PUTARG_SPLIT` * Add a lowering optimization that removes `BITCAST` by changing the operand (by changing constants to other constants or the type of indirections) * Stop DNER'ing for register file mismatches in physical promotion and morph
1 parent b8298f6 commit b567c5b

File tree

7 files changed

+245
-369
lines changed

7 files changed

+245
-369
lines changed

src/coreclr/jit/compiler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3119,7 +3119,7 @@ class Compiler
31193119
Statement* gtNewStmt(GenTree* expr, const DebugInfo& di);
31203120

31213121
// For unary opers.
3122-
GenTree* gtNewOperNode(genTreeOps oper, var_types type, GenTree* op1);
3122+
GenTreeUnOp* gtNewOperNode(genTreeOps oper, var_types type, GenTree* op1);
31233123

31243124
// For binary opers.
31253125
GenTreeOp* gtNewOperNode(genTreeOps oper, var_types type, GenTree* op1, GenTree* op2);
@@ -3208,7 +3208,7 @@ class Compiler
32083208

32093209
GenTree* gtNewPutArgReg(var_types type, GenTree* arg, regNumber argReg);
32103210

3211-
GenTree* gtNewBitCastNode(var_types type, GenTree* arg);
3211+
GenTreeUnOp* gtNewBitCastNode(var_types type, GenTree* arg);
32123212

32133213
public:
32143214
GenTreeCall* gtNewCallNode(gtCallTypes callType,

src/coreclr/jit/compiler.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,14 +1411,14 @@ inline Statement* Compiler::gtNewStmt(GenTree* expr, const DebugInfo& di)
14111411
return stmt;
14121412
}
14131413

1414-
inline GenTree* Compiler::gtNewOperNode(genTreeOps oper, var_types type, GenTree* op1)
1414+
inline GenTreeUnOp* Compiler::gtNewOperNode(genTreeOps oper, var_types type, GenTree* op1)
14151415
{
14161416
assert((GenTree::OperKind(oper) & (GTK_UNOP | GTK_BINOP)) != 0);
14171417
assert((GenTree::OperKind(oper) & GTK_EXOP) == 0); // Can't use this to construct any types that extend unary/binary
14181418
// operator.
14191419
assert(op1 != nullptr || oper == GT_RETFILT || (oper == GT_RETURN && type == TYP_VOID));
14201420

1421-
GenTree* node = new (this, oper) GenTreeOp(oper, type, op1, nullptr);
1421+
GenTreeUnOp* node = new (this, oper) GenTreeOp(oper, type, op1, nullptr);
14221422

14231423
return node;
14241424
}

src/coreclr/jit/gentree.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9153,20 +9153,12 @@ GenTree* Compiler::gtNewPutArgReg(var_types type, GenTree* arg, regNumber argReg
91539153
// Notes:
91549154
// The node is generated as GenTreeMultiRegOp on RyuJIT/arm, as GenTreeOp on all the other archs.
91559155
//
9156-
GenTree* Compiler::gtNewBitCastNode(var_types type, GenTree* arg)
9156+
GenTreeUnOp* Compiler::gtNewBitCastNode(var_types type, GenTree* arg)
91579157
{
91589158
assert(arg != nullptr);
91599159
assert(type != TYP_STRUCT);
91609160

9161-
GenTree* node = nullptr;
9162-
#if defined(TARGET_ARM)
9163-
// A BITCAST could be a MultiRegOp on arm since we could move a double register to two int registers.
9164-
node = new (this, GT_BITCAST) GenTreeMultiRegOp(GT_BITCAST, type, arg, nullptr);
9165-
#else
9166-
node = gtNewOperNode(GT_BITCAST, type, arg);
9167-
#endif
9168-
9169-
return node;
9161+
return gtNewOperNode(GT_BITCAST, type, arg);
91709162
}
91719163

91729164
//------------------------------------------------------------------------

0 commit comments

Comments
 (0)