Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b88ff31
Replace successive "ldr" and "str" instructions with "ldp" and "stp"
AndyJGraham Sep 6, 2022
f0c918c
No longer use a temporary buffer to build the optimized instruction.
AndyJGraham Oct 31, 2022
f1b236e
Addressed assorted review comments.
AndyJGraham Nov 1, 2022
c0533bd
Now optimizes ascending locations and decending locations with
AndyJGraham Nov 3, 2022
372ee97
Modification to remove last instructions.
AndyJGraham Nov 14, 2022
12fc291
Merge branch 'main'
AndyJGraham Nov 15, 2022
0b377ed
Ongoing improvements to remove previously-emitted instruction
AndyJGraham Nov 29, 2022
46b85f8
Stopped optimization of consecutive instructions that straddled an in…
AndyJGraham Dec 1, 2022
e4741f9
Addressed code change requests in GitHub.
AndyJGraham Dec 1, 2022
2822f64
Merge branch 'main'
AndyJGraham Dec 1, 2022
10a4510
Various fixes to ldp/stp optimization
BruceForstall Dec 2, 2022
d80a69a
Merge pull request #1 from BruceForstall/LdpStp_Modifications_Fixes
AndyJGraham Dec 5, 2022
f6a49bf
Delete unnecessary and incorrect assert
BruceForstall Dec 7, 2022
ed4d070
Merge pull request #2 from BruceForstall/LdpStp_Modifications_FixAsse…
AndyJGraham Dec 7, 2022
4b0e51e
Diagnostic change only, to confirm whether a theory is correct or
AndyJGraham Dec 9, 2022
2997a8e
Revert "Diagnostic change only, to confirm whether a theory is correc…
AndyJGraham Dec 14, 2022
f0907cc
Do not merge. Temporarily removed calls to
AndyJGraham Dec 14, 2022
c5c4234
Modifications to better update the IP mapping table for a replaced in…
AndyJGraham Dec 15, 2022
bb8fdea
Merge branch 'main' of ssh://gerrit.oss.arm.com/enterprise-llt/dotnet…
AndyJGraham Dec 16, 2022
65eed90
Minor formatting change.
AndyJGraham Dec 16, 2022
e03b375
Check for out of range offsets
a74nh Jan 10, 2023
2cef6fc
Don't optimise during prolog/epilog
a74nh Jan 16, 2023
41a9828
Merge branch 'dotnet:main' into LdpStp_Modifications
a74nh Jan 16, 2023
ba89fd3
Fix windows build error
a74nh Jan 16, 2023
1fbf423
Merge branch main
a74nh Jan 19, 2023
ca9a325
IGF_HAS_REMOVED_INSTR is ARM64 only
a74nh Jan 20, 2023
e66ad66
Add OptimizeLdrStr function
a74nh Jan 20, 2023
8b44843
Fix formatting
a74nh Jan 20, 2023
2e7aaf6
Ensure local variables are tracked
a74nh Jan 24, 2023
fe76782
Don't peephole local variables
a74nh Jan 25, 2023
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
Prev Previous commit
Next Next commit
Diagnostic change only, to confirm whether a theory is correct or
not when chasing an error.
  • Loading branch information
AndyJGraham committed Dec 9, 2022
commit 4b0e51e87af44cbef5b9e643f9c5bf7aff48b548
15 changes: 14 additions & 1 deletion src/coreclr/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9122,11 +9122,22 @@ void emitter::emitNxtIG(bool extend)
// NOTE: It is expected that the GC effect of the removed instruction will be handled by the newly
// generated replacement(s).
//
void emitter::emitRemoveLastInstruction()
bool emitter::emitRemoveLastInstruction()
{
assert(emitLastIns != nullptr);
assert(emitLastInsIG != nullptr);

#ifdef TARGET_ARM64
// AJG - This is a temporary change, to prevent the first
// instruction in a group to be optimised away.
// This is for diagnostic and test purposes only.

if (emitCurIGinsCnt == 1)
{
return false;
}
#endif

JITDUMP("Removing saved instruction in %s:\n> ", emitLabelString(emitLastInsIG));
JITDUMPEXEC(dispIns(emitLastIns))

Expand Down Expand Up @@ -9175,6 +9186,8 @@ void emitter::emitRemoveLastInstruction()

emitLastIns = nullptr;
emitLastInsIG = nullptr;

return true;
}

/*****************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/emit.h
Original file line number Diff line number Diff line change
Expand Up @@ -2181,7 +2181,7 @@ class emitter
insGroup* emitSavIG(bool emitAdd = false);
void emitNxtIG(bool extend = false);

void emitRemoveLastInstruction();
bool emitRemoveLastInstruction();

bool emitCurIGnonEmpty()
{
Expand Down
40 changes: 24 additions & 16 deletions src/coreclr/jit/emitarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16219,24 +16219,32 @@ bool emitter::TryReplaceLdrStrWithPairInstr(
}

// Remove the last instruction written.
emitRemoveLastInstruction();

// We need to scale the immediate value by the operand size.
// This is either the "old" immediate (for ascending) or the
// "current" immediate (for descending) register order.
if (optimizationOrder == eRO_ascending)
{
// The FIRST register is at the lower offset
emitIns_R_R_R_I(optIns, oldReg1Attr, oldReg1, reg1, reg2, oldImm * size, INS_OPTS_NONE, reg1Attr);
}
else
// This has been temporarily changed to allow the function
// to "refuse" to remove an instruction for diagnostic purposes only.
if (emitRemoveLastInstruction())
{
// The SECOND register is at the lower offset
emitIns_R_R_R_I(optIns, reg1Attr, reg1, oldReg1, reg2, imm * size, INS_OPTS_NONE, oldReg1Attr);
}
// The above function can refuse to remove an emitted
// instruction, for diagnostic purposes only.

// And now return true, to indicate that the second instruction descriptor is no longer to be emitted.
return true;
// It HAS removed an instruction this time.

// We need to scale the immediate value by the operand size.
// This is either the "old" immediate (for ascending) or the
// "current" immediate (for descending) register order.
if (optimizationOrder == eRO_ascending)
{
// The FIRST register is at the lower offset
emitIns_R_R_R_I(optIns, oldReg1Attr, oldReg1, reg1, reg2, oldImm * size, INS_OPTS_NONE, reg1Attr);
}
else
{
// The SECOND register is at the lower offset
emitIns_R_R_R_I(optIns, reg1Attr, reg1, oldReg1, reg2, imm * size, INS_OPTS_NONE, oldReg1Attr);
}

// And now return true, to indicate that the second instruction descriptor is no longer to be emitted.
return true;
}
}

return false;
Expand Down