From 67cf035a994bdbe87183751775d4bc7b816f52b1 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 7 Apr 2015 00:09:59 +0000 Subject: [WinEH] Don't create an alloca for unnamed catch parameters The catch object parameter to llvm.eh.begincatch is optional, and can be null. We can save some ourselves the stack space, copy ctor, and dtor calls if we pass null. llvm-svn: 234264 --- clang/lib/CodeGen/MicrosoftCXXABI.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/MicrosoftCXXABI.cpp') diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp index 2a76203e71c..f00cd9c81df 100644 --- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp @@ -809,7 +809,9 @@ void MicrosoftCXXABI::emitBeginCatch(CodeGenFunction &CGF, llvm::Function *BeginCatch = CGF.CGM.getIntrinsic(llvm::Intrinsic::eh_begincatch); - if (!CatchParam) { + // If this is a catch-all or the catch parameter is unnamed, we don't need to + // emit an alloca to the object. + if (!CatchParam || !CatchParam->getDeclName()) { llvm::Value *Args[2] = {Exn, llvm::Constant::getNullValue(CGF.Int8PtrTy)}; CGF.EmitNounwindRuntimeCall(BeginCatch, Args); CGF.EHStack.pushCleanup(NormalAndEHCleanup); -- cgit v1.2.3