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

JIT: Clean up and optimize call arg lowering #112639

Merged
merged 3 commits into from
Feb 18, 2025

Conversation

jakobbotsch
Copy link
Member

@jakobbotsch jakobbotsch commented Feb 17, 2025

  • 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

* 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)
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 17, 2025
#endif

return node;
return gtNewOperNode(GT_BITCAST, type, arg);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed simplifying this in #103869.

@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @EgorBo

Diffs. Some minor CQ improvements and some minor TP regressions (with some MinOpts outliers in the collections with few MinOpts contexts).

// Returns:
// True if the bitcast was removed.
//
bool Lowering::TryRemoveBitCast(GenTreeUnOp* node)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious if we run this folding at the import stage as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, we only have some folding for bitcasts in morph, and there we only have the IND/LCL_FLD part of this.
Only reason I ended up adding this is because I hit some regressions in this PR due to the new bitcasts.

// is not the case for NI_Vector128_AsVector128Unsafe which is explicitly taking
// a TYP_SIMD12 and producing a TYP_SIMD16.

type = TYP_SIMD12;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice that this is gone now

@jakobbotsch jakobbotsch merged commit b567c5b into dotnet:main Feb 18, 2025
108 of 112 checks passed
@jakobbotsch jakobbotsch deleted the clean-up-arg-lowering branch February 18, 2025 20:03
grendello added a commit to grendello/runtime that referenced this pull request Feb 19, 2025
* main: (27 commits)
  Fold null checks against known non-null values (dotnet#109164)
  JIT: Always track the context for late devirt (dotnet#112396)
  JIT: array allocation fixes (dotnet#112676)
  [H/3] Fix test closing connection too fast (dotnet#112691)
  Fix LINQ handling of iterator.Take(...).Last(...) (dotnet#112680)
  [browser][MT] move wasm MT CI legs to extra-platforms (dotnet#112690)
  JIT: Don't use `Compiler::compFloatingPointUsed` to check if FP kills are needed (dotnet#112668)
  [LoongArch64] Fix a typo within PR#112166. (dotnet#112672)
  Fix new EH hang on DebugBreak (dotnet#112640)
  Use encode callback instead of renting a buffer to write to in DSAKeyFormatHelper
  Move some links to other doc (dotnet#112574)
  Reflection-based XmlSerializer - Deserialize empty collections and allow for sub-types in collection items. (dotnet#111723)
  JIT: Use `fgCalledCount` for OSR method entry weight (dotnet#112662)
  Use Avx10.2 Instructions in Floating Point Conversions (dotnet#111775)
  Expose StressLog via CDAC and port StressLogAnalyzer to managed code (dotnet#104999)
  JIT: Use linear block order for MinOpts in LSRA (dotnet#108147)
  Update dependencies from https://github.com/dotnet/arcade build 20250213.2 (dotnet#112625)
  JIT: Clean up and optimize call arg lowering (dotnet#112639)
  Update dependencies from https://github.com/dotnet/emsdk build 20250217.1 (dotnet#112645)
  JIT: Support `FIELD_LIST` for returns (dotnet#112308)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants