Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: src/IceTargetLowering.cpp

Issue 2295393002: Subzero: Deterministically sort local var stack offsets. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLowering.cpp
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
index ff93e70819b424a66ba423e10eeed48527cb9351..0ac6e8bee8f9a67b7c6c29f82b0312abab8c7a51 100644
--- a/src/IceTargetLowering.cpp
+++ b/src/IceTargetLowering.cpp
@@ -737,8 +737,11 @@ void TargetLowering::sortVarsByAlignment(VarList &Dest,
// the buckets, if performance is an issue.
std::sort(Dest.begin(), Dest.end(),
[this](const Variable *V1, const Variable *V2) {
- return typeWidthInBytesOnStack(V1->getType()) >
- typeWidthInBytesOnStack(V2->getType());
+ const size_t WidthV1 = typeWidthInBytesOnStack(V1->getType());
+ const size_t WidthV2 = typeWidthInBytesOnStack(V2->getType());
+ if (WidthV1 == WidthV2)
+ return V1->getIndex() < V2->getIndex();
+ return WidthV1 > WidthV2;
});
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698