This is an archive of the discontinued LLVM Phabricator instance.

[IndVars] Remove unreasonable checks in rewriteLoopExitValues
ClosedPublic

Authored by mkazantsev on Aug 29 2018, 12:50 AM.

Details

Summary

A piece of logic in rewriteLoopExitValues has a weird check on number of
users which allowed an unprofitable transform in case if an instruction has
more than 6 users.

Diff Detail

Event Timeline

mkazantsev created this revision.Aug 29 2018, 12:50 AM
mkazantsev edited the summary of this revision. (Show Details)

Rebased.

etherzhhb accepted this revision.Sep 17 2018, 9:50 AM

LGTM

lib/Transforms/Scalar/IndVarSimplify.cpp
614–630

The only suggestion is maybe we could extract this piece of code to a standalone function.
This can make the code easier to understand

This revision is now accepted and ready to land.Sep 17 2018, 9:50 AM
mkazantsev added inline comments.Sep 17 2018, 7:20 PM
lib/Transforms/Scalar/IndVarSimplify.cpp
614–630

It's done in the follow-up patch https://reviews.llvm.org/D51584. I'm merging them one by one just to make reviewers' life easier. :)

etherzhhb added inline comments.Sep 17 2018, 7:57 PM
lib/Transforms/Scalar/IndVarSimplify.cpp
614–630

Is there other patches between this and D51584? I saw some thing like "if (ExitValue->getSCEVType()>=scMulExpr) {" is gone (just out of curiosity :) )

mkazantsev added inline comments.Sep 17 2018, 8:10 PM
lib/Transforms/Scalar/IndVarSimplify.cpp
614–630

Yes there is, https://reviews.llvm.org/D51581

You can use "Stack" tab in Revision Contensts section to see dependencies. :)

As for this check, it's removed in the last patch (I really have no idea why it was there).

This revision was automatically updated to reflect the committed changes.
etherzhhb added inline comments.Sep 18 2018, 8:34 AM
lib/Transforms/Scalar/IndVarSimplify.cpp
614–630

I see