This is an archive of the discontinued LLVM Phabricator instance.

New IR pass: LoopExitValues
Needs ReviewPublic

Authored by srking on Aug 31 2015, 10:14 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This optimization finds loop exit values reevaluated after the loop execution and replaces them by the corresponding exit values if they are available. Such sequences can arise after the SimplifyIndVals+LoopStrengthReduce passes. This pass should be run after LoopStrengthReduce.

Diff Detail

Event Timeline

srking updated this revision to Diff 33588.Aug 31 2015, 10:14 AM
srking retitled this revision from to New IR pass: LoopExitValues.
srking updated this object.
jmolloy set the repository for this revision to rL LLVM.Aug 31 2015, 1:08 PM
jmolloy added subscribers: jmolloy, llvm-commits.
hfinkel added inline comments.
lib/CodeGen/Passes.cpp
411

Fix indenting.

lib/Transforms/Scalar/LoopExitValues.cpp
1

Stale header comment.

149

not -> ! [to match our general conventions]

154

You should do the type-based validity checking prior to calling DT.dominates (which is going to be significantly more expensive).

Also, when do the types not match? Can getSCEVAtScope return an SCEV with a different type than its argument?

Hi Steve,

I wonder if it might be related to PR24920 (and D12765). Out of curiosity, could you check what happens in your testcase with the patch from there applied?
Also, some comments inline:

Thanks,
Michael

lib/Transforms/Scalar/LoopExitValues.cpp
32

s/is/in/

135

This resembles what SCEVExpander does (particularly, findExistingExpansion function). Would it be possible/beneficial to just reuse it here somehow?

test/Transforms/LoopExitValues/matrix_mul.ll
1–2

It probably needs ; REQUIRES: Asserts

Any particular reason this was never followed through? This pass might solve https://bugs.llvm.org/show_bug.cgi?id=42965 .

Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2019, 8:21 AM
marksl added a subscriber: marksl.Jan 6 2021, 4:25 PM