aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCDwarf.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2024-06-04 15:06:12 -0700
committerFangrui Song <i@maskray.me>2024-06-04 15:06:12 -0700
commitcb09b5f3d53e5b7b4452bb3db78dca79fc9b3f17 (patch)
treee4b50b6f192c58e497cdb5f8f905f97e2480b26a /llvm/lib/MC/MCDwarf.cpp
parente949b54a5b7cd7cd0690fa126be3363a21f05a8e (diff)
downloadllvm-cb09b5f3d53e5b7b4452bb3db78dca79fc9b3f17.zip
llvm-cb09b5f3d53e5b7b4452bb3db78dca79fc9b3f17.tar.gz
llvm-cb09b5f3d53e5b7b4452bb3db78dca79fc9b3f17.tar.bz2
[MC] Disable MCAssembler based constant folding for compact unwind and emitJumpTableEntry
Similar to commit 245491a9f384e4c53421196533c2a2b693efaf8d for DwarfDebug. This completely disables the expensive MCFragment walk code in `AttemptToFoldSymbolOffsetDifference` when compiling sqlite3.i for macOS. In the future, we should try enabling the MCFragment walk only for constructs like `.if . -_start == 1` and `.subsection a-b` and remove these `setUseAssemblerInfoForParsing`.
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r--llvm/lib/MC/MCDwarf.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index aba4071..f7bc3a6 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -1864,6 +1864,12 @@ void MCDwarfFrameEmitter::Emit(MCObjectStreamer &Streamer, MCAsmBackend *MAB,
FrameEmitterImpl Emitter(IsEH, Streamer);
ArrayRef<MCDwarfFrameInfo> FrameArray = Streamer.getDwarfFrameInfos();
+ // Disable AttemptToFoldSymbolOffsetDifference folding of EmitCompactUnwind
+ // and fdeStart-cieStart for EmitFDE due to the the performance issue. The
+ // label differences will be evaluate at write time.
+ assert(Streamer.getUseAssemblerInfoForParsing());
+ Streamer.setUseAssemblerInfoForParsing(false);
+
// Emit the compact unwind info if available.
bool NeedsEHFrameSection = !MOFI->getSupportsCompactUnwindWithoutEHFrame();
if (IsEH && MOFI->getCompactUnwindSection()) {
@@ -1910,11 +1916,6 @@ void MCDwarfFrameEmitter::Emit(MCObjectStreamer &Streamer, MCAsmBackend *MAB,
[](const MCDwarfFrameInfo &X, const MCDwarfFrameInfo &Y) {
return CIEKey(X) < CIEKey(Y);
});
- // Disable AttemptToFoldSymbolOffsetDifference folding of fdeStart-cieStart
- // for EmitFDE due to the the performance issue. The label differences will be
- // evaluate at write time.
- assert(Streamer.getUseAssemblerInfoForParsing());
- Streamer.setUseAssemblerInfoForParsing(false);
for (auto I = FrameArrayX.begin(), E = FrameArrayX.end(); I != E;) {
const MCDwarfFrameInfo &Frame = *I;
++I;