Skip to content

Commit

Permalink
Delete gtGetStructHandle and friends (#84212)
Browse files Browse the repository at this point in the history
* Delete gtGetStructHandle[IfPresent]

Replaced with GenTree::GetLayout.

* Delete the canonical handle logic

* Delete handle handling from fgMakeMultiUse

* Delete gtGetStructHandleForSIMD and friends

* Delete now-unused SIMD cache entries

* Fix SIMD

* Fix fgMakeMultiUse

* Delete the IsSimdAsHWIntrinsic logic

No longer needed.

* Fix formatting
  • Loading branch information
SingleAccretion authored Apr 10, 2023
1 parent 053e17a commit a7f3df9
Show file tree
Hide file tree
Showing 13 changed files with 699 additions and 1,519 deletions.
359 changes: 47 additions & 312 deletions src/coreclr/jit/compiler.h

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions src/coreclr/jit/fginline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1658,14 +1658,12 @@ Statement* Compiler::fgInlinePrependStatements(InlineInfo* inlineInfo)

if (varTypeIsStruct(argType))
{
structHnd = gtGetStructHandleIfPresent(argNode);
noway_assert((structHnd != NO_CLASS_HANDLE) || (argType != TYP_STRUCT));
structHnd = lclVarInfo[argNum].lclVerTypeInfo.GetClassHandleForValueClass();
assert(structHnd != NO_CLASS_HANDLE);
}

// Unsafe value cls check is not needed for
// argTmpNum here since in-linee compiler instance
// would have iterated over these and marked them
// accordingly.
// Unsafe value cls check is not needed for argTmpNum here since in-linee compiler instance
// would have iterated over these and marked them accordingly.
impAssignTempGen(tmpNum, argNode, structHnd, CHECK_SPILL_NONE, &afterStmt, callDI, block);

// We used to refine the temp type here based on
Expand Down
11 changes: 1 addition & 10 deletions src/coreclr/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2146,16 +2146,7 @@ GenTree* Compiler::fgCreateMonitorTree(unsigned lvaMonAcquired, unsigned lvaThis
// ret(...) ->
// ret(comma(comma(tmp=...,call mon_exit), tmp))
//
//
// Before morph stage, it is possible to have a case of GT_RETURN(TYP_LONG, op1) where op1's type is
// TYP_STRUCT (of 8-bytes) and op1 is call node. See the big comment block in impReturnInstruction()
// for details for the case where info.compRetType is not the same as info.compRetNativeType. For
// this reason pass compMethodInfo->args.retTypeClass which is guaranteed to be a valid class handle
// if the return type is a value class. Note that fgInsertCommFormTemp() in turn uses this class handle
// if the type of op1 is TYP_STRUCT to perform lvaSetStruct() on the new temp that is created, which
// in turn passes it to VM to know the size of value type.
GenTree* temp = fgInsertCommaFormTemp(&retNode->AsOp()->gtOp1, info.compMethodInfo->args.retTypeClass);

GenTree* temp = fgInsertCommaFormTemp(&retNode->AsOp()->gtOp1);
GenTree* lclVar = retNode->AsOp()->gtOp1->AsOp()->gtOp2;

// The return can't handle all of the trees that could be on the right-hand-side of an assignment,
Expand Down
1,002 changes: 363 additions & 639 deletions src/coreclr/jit/gentree.cpp

Large diffs are not rendered by default.

23 changes: 4 additions & 19 deletions src/coreclr/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,6 @@ enum GenTreeFlags : unsigned int
GTF_MDARRLEN_NONFAULTING = 0x20000000, // GT_MDARR_LENGTH -- An MD array length operation that cannot fault. Same as GT_IND_NONFAULTING.

GTF_MDARRLOWERBOUND_NONFAULTING = 0x20000000, // GT_MDARR_LOWER_BOUND -- An MD array lower bound operation that cannot fault. Same as GT_IND_NONFAULTING.

GTF_SIMDASHW_OP = 0x80000000, // GT_HWINTRINSIC -- Indicates that the structHandle should be gotten from gtGetStructHandleForSIMD
// rather than from gtGetStructHandleForHWSIMD.
};

inline constexpr GenTreeFlags operator ~(GenTreeFlags a)
Expand Down Expand Up @@ -6161,11 +6158,10 @@ struct GenTreeHWIntrinsic : public GenTreeJitIntrinsic
IntrinsicNodeBuilder&& nodeBuilder,
NamedIntrinsic hwIntrinsicID,
CorInfoType simdBaseJitType,
unsigned simdSize,
bool isSimdAsHWIntrinsic)
unsigned simdSize)
: GenTreeJitIntrinsic(GT_HWINTRINSIC, type, std::move(nodeBuilder), simdBaseJitType, simdSize)
{
Initialize(hwIntrinsicID, isSimdAsHWIntrinsic);
Initialize(hwIntrinsicID);
}

template <typename... Operands>
Expand All @@ -6174,11 +6170,10 @@ struct GenTreeHWIntrinsic : public GenTreeJitIntrinsic
NamedIntrinsic hwIntrinsicID,
CorInfoType simdBaseJitType,
unsigned simdSize,
bool isSimdAsHWIntrinsic,
Operands... operands)
: GenTreeJitIntrinsic(GT_HWINTRINSIC, type, allocator, simdBaseJitType, simdSize, operands...)
{
Initialize(hwIntrinsicID, isSimdAsHWIntrinsic);
Initialize(hwIntrinsicID);
}

#if DEBUGGABLE_GENTREE
Expand All @@ -6191,11 +6186,6 @@ struct GenTreeHWIntrinsic : public GenTreeJitIntrinsic
bool OperIsMemoryStore(GenTree** pAddr = nullptr) const;
bool OperIsMemoryLoadOrStore() const;

bool IsSimdAsHWIntrinsic() const
{
return (gtFlags & GTF_SIMDASHW_OP) != 0;
}

unsigned GetResultOpNumForFMA(GenTree* use, GenTree* op1, GenTree* op2, GenTree* op3);

ClassLayout* GetLayout(Compiler* compiler) const;
Expand Down Expand Up @@ -6289,7 +6279,7 @@ struct GenTreeHWIntrinsic : public GenTreeJitIntrinsic
private:
void SetHWIntrinsicId(NamedIntrinsic intrinsicId);

void Initialize(NamedIntrinsic intrinsicId, bool isSimdAsHWIntrinsic)
void Initialize(NamedIntrinsic intrinsicId)
{
SetHWIntrinsicId(intrinsicId);

Expand All @@ -6305,11 +6295,6 @@ struct GenTreeHWIntrinsic : public GenTreeJitIntrinsic
gtFlags |= GTF_ASG;
}
}

if (isSimdAsHWIntrinsic)
{
gtFlags |= GTF_SIMDASHW_OP;
}
}
};
#endif // FEATURE_HW_INTRINSICS
Expand Down
Loading

0 comments on commit a7f3df9

Please sign in to comment.