From e07f4d4f859e519bf6ee1793884314f1ac30f7a3 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Fri, 8 Nov 2024 15:51:12 -0800 Subject: [PATCH 1/2] Disable UseAggressiveReg2MemForCodeSize on WASM It causes an LLVM WASM backend instruction selection failure. rdar://139541259 --- lib/Frontend/CompilerInvocation.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index a20fc2a7c838c..b614a3033dbc5 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -3786,6 +3786,11 @@ bool CompilerInvocation::parseArgs( OPT_disable_aggressive_reg2mem, SILOpts.UseAggressiveReg2MemForCodeSize); + // We ran into a LLVM backed instruction selection failure. + // This is a workaround. + if (LangOpts.Target.isWasm()) + SILOpts.UseAggressiveReg2MemForCodeSize = false; + // With Swift 6, enable @_spiOnly by default. This also enables proper error // reporting of ioi references from spi decls. if (LangOpts.EffectiveLanguageVersion.isVersionAtLeast(6)) { From 05db4f091e7b531bb92fb1bb2d89ac9a7177c2ec Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Fri, 8 Nov 2024 15:58:38 -0800 Subject: [PATCH 2/2] Fix spelling in comment --- lib/Frontend/CompilerInvocation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index b614a3033dbc5..233169ee52b45 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -3786,7 +3786,7 @@ bool CompilerInvocation::parseArgs( OPT_disable_aggressive_reg2mem, SILOpts.UseAggressiveReg2MemForCodeSize); - // We ran into a LLVM backed instruction selection failure. + // We ran into an LLVM backend instruction selection failure. // This is a workaround. if (LangOpts.Target.isWasm()) SILOpts.UseAggressiveReg2MemForCodeSize = false;