Skip to content

Commit 57f870f

Browse files
authored
JIT: Improve strength reduction's prediction of loop reversal (#104800)
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.
1 parent 82ce118 commit 57f870f

File tree

2 files changed

+200
-120
lines changed

2 files changed

+200
-120
lines changed

src/coreclr/jit/compiler.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7646,6 +7646,8 @@ class Compiler
76467646
FlowGraphNaturalLoop* loop,
76477647
BasicBlock* exiting,
76487648
LoopLocalOccurrences* loopLocals);
7649+
bool optCanAndShouldChangeExitTest(GenTree* cond, bool dump);
7650+
bool optPrimaryIVHasNonLoopUses(unsigned lclNum, FlowGraphNaturalLoop* loop, LoopLocalOccurrences* loopLocals);
76497651
bool optWidenPrimaryIV(FlowGraphNaturalLoop* loop,
76507652
unsigned lclNum,
76517653
ScevAddRec* addRec,

0 commit comments

Comments
 (0)