This is an archive of the discontinued LLVM Phabricator instance.

[MachinePipeliner] Fix risky iterator usage R++, --R
ClosedPublic

Authored by jsji on Jun 18 2019, 8:54 PM.

Details

Summary

When we calculateResMII, we use two loops, one with iterator

(*RI++)->canReserveResources

to check whether we can reserve the resource,
then later in another loop, we use

--RI;
(*RI)->reserveResources(*MI);

Trying to move back iterator to do reservation.

This is risky, as after several iterator R++,
--R may not move back to point to the same Resource at all,
so we may actually test with one Resource, but reserve in another Resources,
hence overbooking some Resource.

The can cause wrong MII being calculated.

Diff Detail

Repository
rL LLVM

Event Timeline

jsji created this revision.Jun 18 2019, 8:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 18 2019, 8:55 PM
jsji added a comment.Jun 25 2019, 8:35 AM

Ping... Any comments or feedback, especially for Hexagon? @bcahoon

bcahoon accepted this revision.Jun 25 2019, 12:22 PM

Looks good to me. Thanks for the fix!

Thanks,
Brendon

This revision is now accepted and ready to land.Jun 25 2019, 12:22 PM
This revision was automatically updated to reflect the committed changes.