This is an archive of the discontinued LLVM Phabricator instance.

[LoopUnroll] Use LoopSize+1 as threshold, to allow unrolling loops matching LoopSize.
ClosedPublic

Authored by fhahn on Sep 15 2019, 11:38 AM.

Details

Summary

We use < UP.Threshold later on, so we should use LoopSize + 1, to
allow unrolling if the result won't exceed to loop size.

Fixes PR43305.

Diff Detail

Repository
rL LLVM

Event Timeline

fhahn created this revision.Sep 15 2019, 11:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2019, 11:38 AM

So we unroll the loop if the sizes are equal too? Sounds sensible to me.

llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
1036 ↗(On Diff #220250)

Can you update this comment with why it's +1.

fhahn updated this revision to Diff 220312.Sep 16 2019, 5:11 AM

Adjust comment and test case.

fhahn marked an inline comment as done.Sep 16 2019, 5:22 AM
fhahn added inline comments.
llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
1036 ↗(On Diff #220250)

done, thanks!

dmgreen accepted this revision.Sep 16 2019, 5:58 AM

LGTM

This revision is now accepted and ready to land.Sep 16 2019, 5:58 AM
This revision was automatically updated to reflect the committed changes.