Skip to content

Commit

Permalink
JIT: Improve strength reduction's prediction of loop reversal (#104800)
Browse files Browse the repository at this point in the history
The current goal is to make sure strength reduction does not introduce new
primary IVs. To do so we rely on the downwards-loop transformation to get rid of
uses of the primary IV in the loop test.
This PR refines the checks that strength reduction was using to predict whether
a use of the primary IV in a loop test will be removed. It should now be the
exact same checks as the downwards-transformation uses.

Additionally, it means we can remove `CursorInfo::IsInsideExitTest`; we now just
avoid creating the cursor in the first place if we know the use will be
removable.
  • Loading branch information
jakobbotsch authored Jul 17, 2024
1 parent 82ce118 commit 57f870f
Show file tree
Hide file tree
Showing 2 changed files with 200 additions and 120 deletions.
2 changes: 2 additions & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -7646,6 +7646,8 @@ class Compiler
FlowGraphNaturalLoop* loop,
BasicBlock* exiting,
LoopLocalOccurrences* loopLocals);
bool optCanAndShouldChangeExitTest(GenTree* cond, bool dump);
bool optPrimaryIVHasNonLoopUses(unsigned lclNum, FlowGraphNaturalLoop* loop, LoopLocalOccurrences* loopLocals);
bool optWidenPrimaryIV(FlowGraphNaturalLoop* loop,
unsigned lclNum,
ScevAddRec* addRec,
Expand Down
Loading

0 comments on commit 57f870f

Please sign in to comment.