Skip to content

Commit

Permalink
Improve LSRA and other dump output (#71499)
Browse files Browse the repository at this point in the history
E.g.,

Update LSRA "Allocating Registers" table description.

Dump nodes added during resolution, e.g.:
```
   BB29 bottom (BB08->BB08): move V25 from STK to rdi (Critical)
N001 (  1,  1) [001174] ----------z                 t1174 =    LCL_VAR   int    V25 cse4          rdi REG rdi
```

Dump more data in the LSRA block sequence data:
```
-BB03( 16   )
-BB04(  4   )
+BB03 ( 16   ) critical-in critical-out
+BB04 (  4   ) critical-out
```

When dumping various flow bitvectors, annotate the bitvectors better:
```
-BB25 in gen out
-0000000000000000
-0000000000000003 CSE #1.c
-0000000000000003 CSE #1.c
+BB25
+ in: 0000000000000000
+gen: 0000000000000003 CSE #1.c
+out: 0000000000000003 CSE #1.c
```

Dump hoisting bitvectors using the sorting number:
```
-  USEDEF  (5)={V04 V00 V01 V02 V03}
+  USEDEF  (5)={V00 V01 V02 V03 V04}
```

Also, fix various typos and formatting.
  • Loading branch information
BruceForstall authored Jun 30, 2022
1 parent 436ee2e commit 9885fbe
Show file tree
Hide file tree
Showing 12 changed files with 173 additions and 128 deletions.
1 change: 1 addition & 0 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4706,6 +4706,7 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
// Figure out what locals are address-taken.
//
DoPhase(this, PHASE_STR_ADRLCL, &Compiler::fgMarkAddressExposedLocals);

// Run a simple forward substitution pass.
//
DoPhase(this, PHASE_FWD_SUB, &Compiler::fgForwardSub);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1894,7 +1894,7 @@ GenTree* Compiler::fgCreateMonitorTree(unsigned lvaMonAcquired, unsigned lvaThis
{
// have to insert this immediately before the GT_RETURN so we transform:
// ret(...) ->
// ret(comma(comma(tmp=...,call mon_exit), tmp)
// 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
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@ struct GenTree
return (gtOper == GT_LCL_FLD || gtOper == GT_LCL_FLD_ADDR || gtOper == GT_STORE_LCL_FLD);
}

inline bool OperIsLocalField() const
bool OperIsLocalField() const
{
return OperIsLocalField(gtOper);
}
Expand Down Expand Up @@ -8673,13 +8673,13 @@ inline GenTree* GenTree::gtEffectiveVal(bool commaOnly /* = false */)
}

//-------------------------------------------------------------------------
// gtCommaAssignVal - find value being assigned to a comma wrapped assigment
// gtCommaAssignVal - find value being assigned to a comma wrapped assignment
//
// Returns:
// tree representing value being assigned if this tree represents a
// comma-wrapped local definition and use.
//
// original tree, of not.
// original tree, if not.
//
inline GenTree* GenTree::gtCommaAssignVal()
{
Expand Down
25 changes: 12 additions & 13 deletions src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3188,7 +3188,7 @@ GenTree* Compiler::impInitializeArrayIntrinsic(CORINFO_SIG_INFO* sig)
GenTree* arrayLocalNode = impStackTop(1).val;

//
// Verify that the field token is known and valid. Note that It's also
// Verify that the field token is known and valid. Note that it's also
// possible for the token to come from reflection, in which case we cannot do
// the optimization and must therefore revert to calling the helper. You can
// see an example of this in bvt\DynIL\initarray2.exe (in Main).
Expand Down Expand Up @@ -8108,7 +8108,7 @@ void Compiler::impImportAndPushBox(CORINFO_RESOLVED_TOKEN* pResolvedToken)
}

//------------------------------------------------------------------------
// impImportNewObjArray: Build and import `new` of multi-dimmensional array
// impImportNewObjArray: Build and import `new` of multi-dimensional array
//
// Arguments:
// pResolvedToken - The CORINFO_RESOLVED_TOKEN that has been initialized
Expand All @@ -8123,7 +8123,7 @@ void Compiler::impImportAndPushBox(CORINFO_RESOLVED_TOKEN* pResolvedToken)
// Notes:
// Multi-dimensional array constructors are imported as calls to a JIT
// helper, not as regular calls.

//
void Compiler::impImportNewObjArray(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_CALL_INFO* pCallInfo)
{
GenTree* classHandle = impParentClassTokenToHandle(pResolvedToken);
Expand Down Expand Up @@ -8160,7 +8160,7 @@ void Compiler::impImportNewObjArray(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORI
// The arguments of the CORINFO_HELP_NEW_MDARR helper are:
// - Array class handle
// - Number of dimension arguments
// - Pointer to block of int32 dimensions - address of lvaNewObjArrayArgs temp.
// - Pointer to block of int32 dimensions: address of lvaNewObjArrayArgs temp.
//

node = gtNewLclvNode(lvaNewObjArrayArgs, TYP_BLK);
Expand Down Expand Up @@ -13695,15 +13695,15 @@ void Compiler::impImportBlockCode(BasicBlock* block)
{
lclTyp = JITtype2varType(cit);
}
goto ARR_LD_POST_VERIFY;
goto ARR_LD;
}

// Similarly, if its a readonly access, we can do a simple address-of
// without doing a runtime type-check
if (prefixFlags & PREFIX_READONLY)
{
lclTyp = TYP_REF;
goto ARR_LD_POST_VERIFY;
goto ARR_LD;
}

// Otherwise we need the full helper function with run-time type check
Expand Down Expand Up @@ -13747,7 +13747,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
tiRetVal = verMakeTypeInfo(ldelemClsHnd); // precise type always needed for struct
tiRetVal.NormaliseForStack();
}
goto ARR_LD_POST_VERIFY;
goto ARR_LD;

case CEE_LDELEM_I1:
lclTyp = TYP_BYTE;
Expand Down Expand Up @@ -13784,7 +13784,6 @@ void Compiler::impImportBlockCode(BasicBlock* block)
goto ARR_LD;

ARR_LD:
ARR_LD_POST_VERIFY:

op2 = impPopStack().val; // index
op1 = impPopStack().val; // array
Expand Down Expand Up @@ -15345,14 +15344,14 @@ void Compiler::impImportBlockCode(BasicBlock* block)
// Insert the security callout before any actual code is generated
impHandleAccessAllowed(callInfo.accessAllowed, &callInfo.callsiteCalloutHelper);

// There are three different cases for new
// Object size is variable (depends on arguments)
// There are three different cases for new.
// Object size is variable (depends on arguments).
// 1) Object is an array (arrays treated specially by the EE)
// 2) Object is some other variable sized object (e.g. String)
// 3) Class Size can be determined beforehand (normal case)
// In the first case, we need to call a NEWOBJ helper (multinewarray)
// in the second case we call the constructor with a '0' this pointer
// In the third case we alloc the memory, then call the constuctor
// In the first case, we need to call a NEWOBJ helper (multinewarray).
// In the second case we call the constructor with a '0' this pointer.
// In the third case we alloc the memory, then call the constuctor.

clsFlags = callInfo.classFlags;
if (clsFlags & CORINFO_FLG_ARRAY)
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ GenTree* Lowering::LowerNode(GenTree* node)
ContainCheckBoundsChk(node->AsBoundsChk());
break;
#endif // TARGET_XARCH

case GT_ARR_ELEM:
return LowerArrElem(node);

Expand Down
Loading

0 comments on commit 9885fbe

Please sign in to comment.