This is an archive of the discontinued LLVM Phabricator instance.

[Clang][OpenMPIRBuilder] Fix off-by-one error when dividing by stepsize.
ClosedPublic

Authored by Meinersbur on Jan 29 2022, 12:45 PM.

Details

Summary

When the stepsize does not evenly divide the range's end, round-up to ensure that that last multiple of the stepsize before the reaching the upper boud is reached. For instance, the trip count of

for (int i = 0; i < 7; i+=5)

is two (i=0 and i=5), not (7-0)/5 == 1.

Diff Detail

Event Timeline

Meinersbur created this revision.Jan 29 2022, 12:45 PM
Meinersbur requested review of this revision.Jan 29 2022, 12:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 29 2022, 12:45 PM
Herald added a subscriber: sstefan1. · View Herald Transcript
peixin accepted this revision.Jan 30 2022, 6:26 PM

Function code LGTM. Please fix the CI fail.

This revision is now accepted and ready to land.Jan 30 2022, 6:26 PM
This revision was landed with ongoing or failed builds.Jan 31 2022, 3:29 PM
This revision was automatically updated to reflect the committed changes.