Skip to content

Commit 245491a

Browse files
committed
[MC] Disable MCAssembler based constant folding for DwarfDebug
Related to the poor performance of MCAssembler based constant folding (see `bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm) const` and `AttemptToFoldSymbolOffsetDifference`), commit 9500a5d (#91082) caused -O0 -g compile time regression. 9500a5d special cased .eh_frame FDE emitting. This patch adds a special case to .debug_* emitting as well to mitigate the rest regression. The MCAssembler based constant folding strategy should be improved to remove the two special cases.
1 parent 3591da9 commit 245491a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2463,11 +2463,15 @@ bool AsmPrinter::doFinalization(Module &M) {
24632463
emitGlobalIFunc(M, IFunc);
24642464

24652465
// Finalize debug and EH information.
2466+
// Defer MCAssembler based constant folding due to a performance issue. The
2467+
// label differences will be evaluated at write time.
2468+
OutStreamer->setUseAssemblerInfoForParsing(false);
24662469
for (const HandlerInfo &HI : Handlers) {
24672470
NamedRegionTimer T(HI.TimerName, HI.TimerDescription, HI.TimerGroupName,
24682471
HI.TimerGroupDescription, TimePassesIsEnabled);
24692472
HI.Handler->endModule();
24702473
}
2474+
OutStreamer->setUseAssemblerInfoForParsing(true);
24712475

24722476
// This deletes all the ephemeral handlers that AsmPrinter added, while
24732477
// keeping all the user-added handlers alive until the AsmPrinter is

0 commit comments

Comments
 (0)