diff --git a/lib/IRGen/IRGenSIL.cpp b/lib/IRGen/IRGenSIL.cpp index af85953d60673..d966a39e28b90 100644 --- a/lib/IRGen/IRGenSIL.cpp +++ b/lib/IRGen/IRGenSIL.cpp @@ -656,6 +656,10 @@ class IRGenSILFunction : bool emitLifetimeExtendingUse(llvm::Value *Var) { llvm::Type *ArgTys; auto *Ty = Var->getType(); + // Avoid to emit when Wasm because of lack of register. + if (IGM.TargetInfo.OutputObjectFormat == llvm::Triple::Wasm) { + return false; + } // Vectors, Pointers and Floats are expected to fit into a register. if (Ty->isPointerTy() || Ty->isFloatingPointTy() || Ty->isVectorTy()) ArgTys = {Ty};