Skip to content

Commit d20d82d

Browse files
aaupovGerritBuildBot
authored andcommitted
Revert "[MC] Speed up AttemptToFoldSymbolOffsetDifference in the absence of MCAsmLayout"
Summary: This reverts commit 92d2c1b67835248d5d7371fa06381f970687c68f. Causes timeouts in BOLT tests Test Plan: sandcastle Reviewers: ayermolo, davidino, #llvm-bolt Reviewed By: davidino Differential Revision: https://phabricator.intern.facebook.com/D58066252 Tasks: T191101004 Tags: accept2ship, publish_when_ready
1 parent 64454a7 commit d20d82d

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

llvm/lib/MC/MCExpr.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -675,14 +675,8 @@ static void AttemptToFoldSymbolOffsetDifference(
675675
if (FA == FB) {
676676
Reverse = SA.getOffset() < SB.getOffset();
677677
} else if (!isa<MCDummyFragment>(FA)) {
678-
// Testing FA < FB is slow. Use setLayoutOrder to speed up computation.
679-
// The formal layout order will be finalized in MCAssembler::layout.
680-
if (FA->getLayoutOrder() == 0 || FB->getLayoutOrder()== 0) {
681-
unsigned LayoutOrder = 0;
682-
for (MCFragment &F : *FA->getParent())
683-
F.setLayoutOrder(++LayoutOrder);
684-
}
685-
Reverse = FA->getLayoutOrder() < FB->getLayoutOrder();
678+
Reverse = std::find_if(std::next(FA->getIterator()), SecA.end(),
679+
[&](auto &I) { return &I == FB; }) != SecA.end();
686680
}
687681

688682
uint64_t SAOffset = SA.getOffset(), SBOffset = SB.getOffset();

0 commit comments

Comments
 (0)