r e c u r s i o n i n l i n i n g i n l l v m
play

R E C U R S I O N I N L I N I N G I N L L V M - PowerPoint PPT Presentation

R E C U R S I O N I N L I N I N G I N L L V M P a b l o B a r r i o , A R M C h a n d l e r C a r r u t h , G o o g l e J a m e s M o l l o y , A R M Wh y ? Performance


  1. R E C U R S I O N I N L I N I N G I N L L V M P a b l o B a r r i o , A R M C h a n d l e r C a r r u t h , G o o g l e J a m e s M o l l o y , A R M

  2. Wh y ? ● Performance improvements observed of up to ~20%. ● Potentially improve chances for other optimization passes: ● Increase function size. ● Increase knowledge of the context. ● Current status: ● GCC inlines recursive function calls up to a certain depth. ● LLVM marks recursive functions as noinline. ● Code size and register pressure must be controlled.

  3. # 1 I n l i n e i t e r a t i v e l y f(x): if x == 0 return 1 f(x): a = g(x) if x == 0 return 1 if a == 0 a = g(x) b = 1 L e v e l 1 b = f(a) else: return a + h(b) a1 = g(a) i n l i n e b1 = f(a1) b = a1 + h(b1) return a + h(b)

  4. # 2 R e m o v e r e c u r s i o n w i t h a s t a c k f(x): x1 = x f(x): while x1 != 0: if x == 0 a = g(x) return 1 x1 = a a = g(x) push(a) b = f(a) return a + h(b) b = 1 while S not empty: a = pop() a i s l i v e b = a + h(b) return b

  5. F i b o n a c c i T i m e r e l a t i v e t o G C C b a s e G C C C l a n g B a s e ( - O 3 ) 1 . 0 0 1 . 9 7 S t a c k 2 . 5 3 1 . 1 9 I t e r a t i v e i n l i n i n g 1 . 0 0 1 . 0 4 O b j e c t s i z e ( k B ) G C C C l a n g B a s e ( - O 3 ) 3 . 5 0 2 . 5 4 S t a c k 2 . 6 7 2 . 7 1 I t e r a t i v e i n l i n i n g 3 . 5 0 2 . 7 4

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend