[PATCH] Emit lifetime.start / lifetime.end markers for unnamed temporary objects

Arnaud A. de Grandmaison arnaud.degrandmaison at arm.com
Fri Jul 18 06:49:16 PDT 2014


Committed @ r213379

 

Cheers,

--

Arnaud

 

From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-bounces at cs.uiuc.edu] On Behalf Of Arnaud A. de Grandmaison
Sent: 18 July 2014 09:27
To: 'Reid Kleckner'
Cc: cfe-commits at cs.uiuc.edu
Subject: RE: [PATCH] Emit lifetime.start / lifetime.end markers for unnamed temporary objects

 

Thanks for the review Reid.

 

I will lift CallLifetimeEnd* to CGF and remove the duplication.

 

Cheers,

--

Arnaud A. de Grandmaison

 

From: Reid Kleckner [mailto:rnk at google.com] 
Sent: 18 July 2014 00:12
To: Arnaud De Grandmaison
Cc: cfe-commits at cs.uiuc.edu cfe
Subject: Re: [PATCH] Emit lifetime.start / lifetime.end markers for unnamed temporary objects

 

Looks good with a small change.  I'm surprised we previously only did this for named variables.

 

+namespace {

+/// A cleanup to call @llvm.lifetime.end.

+class CallLifetimeEndForUnnamed : public EHScopeStack::Cleanup {

+  llvm::Value *Addr;

+  llvm::Value *Size;

+

+public:

+  CallLifetimeEndForUnnamed(llvm::Value *addr, llvm::Value *size)

+      : Addr(addr), Size(size) {}

+

+  void Emit(CodeGenFunction &CGF, Flags flags) override {

+    CGF.EmitLifetimeEnd(Size, Addr);

+  }

+};

+}

 

Can we avoid this duplication by adding and using CGF::pushLifetimeEndCleanup?

 

On Thu, Jul 17, 2014 at 2:14 PM, Arnaud A. de Grandmaison <arnaud.degrandmaison at arm.com> wrote:

This will improve stack slot reuse in the LLVM optimizers, especially with C++ where it is so easy to have lots of those unnamed temporaries, with small live ranges.

 

The lifetime markers are only inserted if the temporaries are big enough, using the same value than for named objects (32 bytes).  In a second step, I plan to play with this value to see where we stand with respect to performances & compile time.

 

Could someone familiar with CodeGen have a look at this patch ?

 

Cheers,

--

Arnaud A. de Grandmaison

 


_______________________________________________
cfe-commits mailing list
cfe-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140718/f9781fdc/attachment.html>


More information about the cfe-commits mailing list