Page MenuHomePhabricator

Fix nondeterministic output in local stack slot alloc pass
ClosedPublic

Authored by arsenm on Oct 3 2016, 7:31 AM.

Details

Reviewers
mgrang
MatzeB
Summary

This finds all of the references to a frame index in a function, and
sorts by the offset. If multiple instructions use the same offset,
nothing was breaking the tie for sorting.

This avoids the test failures the reverted r282999 introduced.

Diff Detail

Event Timeline

arsenm updated this revision to Diff 73279.Oct 3 2016, 7:31 AM
arsenm retitled this revision from to Fix nondeterministic output in local stack slot alloc pass.
arsenm updated this object.
arsenm added a subscriber: llvm-commits.
mgrang added a subscriber: mgrang.Oct 18 2016, 11:37 AM

Matthias,

Could you please review this patch? My patch (https://reviews.llvm.org/D25695) tries to fix this by adding a FrameIdx as a tie-breaker.
But as Matt says "the same frame index wit the same offset can appear multiple times".

--Mandeep

mgrang added inline comments.Oct 18 2016, 11:40 AM
lib/CodeGen/LocalStackSlotAllocation.cpp
66

Can we change this into:

bool operator<(const FrameRef &RHS) const {
  return std::tie(LocalOffset, FrameIdx, Order) <
         std::tie(RHS.LocalOffset, RHS.FrameIdx, RHS.Order);
}
MatzeB accepted this revision.Oct 18 2016, 12:59 PM
MatzeB edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Oct 18 2016, 12:59 PM
mgrang edited edge metadata.Oct 19 2016, 11:33 AM

Matt,
Could you please merge this patch?

--Mandeep

arsenm closed this revision.Oct 26 2016, 8:03 AM
arsenm marked an inline comment as done.

r285201