From 344a3780b2e33f6ca763666c380202b18aab72a3 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 29 Jul 2021 22:15:26 +0200 Subject: Vendor import of llvm-project main 88e66fa60ae5, the last commit before the upstream release/13.x branch was created. --- .../CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | 54 ++++++++++++---------- 1 file changed, 30 insertions(+), 24 deletions(-) (limited to 'llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp') diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp index 32a4f60df097..85c6eca5775e 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp @@ -192,10 +192,8 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf, MF->getFrameInfo().CreateVariableSizedObject( Alignment <= StackAlign ? Align(1) : Alignment, AI); } - } - - // Look for inline asm that clobbers the SP register. - if (auto *Call = dyn_cast(&I)) { + } else if (auto *Call = dyn_cast(&I)) { + // Look for inline asm that clobbers the SP register. if (Call->isInlineAsm()) { Register SP = TLI->getStackPointerRegisterToSaveRestore(); const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo(); @@ -214,21 +212,20 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf, } } } - } - - // Look for calls to the @llvm.va_start intrinsic. We can omit some - // prologue boilerplate for variadic functions that don't examine their - // arguments. - if (const auto *II = dyn_cast(&I)) { - if (II->getIntrinsicID() == Intrinsic::vastart) - MF->getFrameInfo().setHasVAStart(true); - } + // Look for calls to the @llvm.va_start intrinsic. We can omit some + // prologue boilerplate for variadic functions that don't examine their + // arguments. + if (const auto *II = dyn_cast(&I)) { + if (II->getIntrinsicID() == Intrinsic::vastart) + MF->getFrameInfo().setHasVAStart(true); + } - // If we have a musttail call in a variadic function, we need to ensure we - // forward implicit register parameters. - if (const auto *CI = dyn_cast(&I)) { - if (CI->isMustTailCall() && Fn->isVarArg()) - MF->getFrameInfo().setHasMustTailInVarArgFunc(true); + // If we have a musttail call in a variadic function, we need to ensure + // we forward implicit register parameters. + if (const auto *CI = dyn_cast(&I)) { + if (CI->isMustTailCall() && Fn->isVarArg()) + MF->getFrameInfo().setHasMustTailInVarArgFunc(true); + } } // Mark values used outside their block as exported, by allocating @@ -333,14 +330,23 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf, else if (Personality == EHPersonality::Wasm_CXX) { WasmEHFuncInfo &EHInfo = *MF->getWasmEHFuncInfo(); - // Map all BB references in the WinEH data to MBBs. - DenseMap NewMap; - for (auto &KV : EHInfo.EHPadUnwindMap) { + // Map all BB references in the Wasm EH data to MBBs. + DenseMap SrcToUnwindDest; + for (auto &KV : EHInfo.SrcToUnwindDest) { const auto *Src = KV.first.get(); - const auto *Dst = KV.second.get(); - NewMap[MBBMap[Src]] = MBBMap[Dst]; + const auto *Dest = KV.second.get(); + SrcToUnwindDest[MBBMap[Src]] = MBBMap[Dest]; + } + EHInfo.SrcToUnwindDest = std::move(SrcToUnwindDest); + DenseMap> UnwindDestToSrcs; + for (auto &KV : EHInfo.UnwindDestToSrcs) { + const auto *Dest = KV.first.get(); + UnwindDestToSrcs[MBBMap[Dest]] = SmallPtrSet(); + for (const auto P : KV.second) + UnwindDestToSrcs[MBBMap[Dest]].insert( + MBBMap[P.get()]); } - EHInfo.EHPadUnwindMap = std::move(NewMap); + EHInfo.UnwindDestToSrcs = std::move(UnwindDestToSrcs); } } -- cgit v1.3