Page MenuHomePhabricator

[LoopFlatten] Loop limit invariant checks
Needs ReviewPublic

Authored by SjoerdMeijer on Oct 14 2020, 2:34 AM.

Details

Summary

If the loop limit is not invariant don't directly bail out, but try to make it invariant with makeLoopInvariant.
I precommitted the test case for this in rG20c7ab87a78c.

Diff Detail

Event Timeline

SjoerdMeijer created this revision.Oct 14 2020, 2:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 14 2020, 2:34 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
SjoerdMeijer requested review of this revision.Oct 14 2020, 2:34 AM
dmgreen added inline comments.Oct 16 2020, 12:20 AM
llvm/lib/Transforms/Scalar/LoopFlatten.cpp
439

All these return false now need to return Changed, I think.

llvm/test/Transforms/LoopFlatten/limit-not-invariant.ll
14

These tests don't then flatten?

SjoerdMeijer added inline comments.Oct 20 2020, 7:37 AM
llvm/test/Transforms/LoopFlatten/limit-not-invariant.ll
14

Well spotted. This patch was part of my grand master plan to support different phi types, and this patch was to get the first little obstacle out of the way. But because of changes in D88880, the input IR and test case might not be so relevant anymore, so I will look at that first now because I still think this is little change is useful.