1 May-Alias Analysis for L3 David Abraham, Elisabeth Crawford, Sue Ann Hong, and Virginia Vassilevska.

Slides:



Advertisements
Similar presentations
Garbage collection David Walker CS 320. Where are we? Last time: A survey of common garbage collection techniques –Manual memory management –Reference.
Advertisements

Comparison and Evaluation of Back Translation Algorithms for Static Single Assignment Form Masataka Sassa #, Masaki Kohama + and Yo Ito # # Dept. of Mathematical.
School of EECS, Peking University “Advanced Compiler Techniques” (Fall 2011) SSA Guo, Yao.
P3 / 2004 Register Allocation. Kostis Sagonas 2 Spring 2004 Outline What is register allocation Webs Interference Graphs Graph coloring Spilling Live-Range.
7. Optimization Prof. O. Nierstrasz Lecture notes by Marcus Denker.
1 CS 201 Compiler Construction Lecture 3 Data Flow Analysis.
19 Classic Examples of Local and Global Code Optimizations Local Constant folding Constant combining Strength reduction.
ECE 454 Computer Systems Programming Compiler and Optimization (I) Ding Yuan ECE Dept., University of Toronto
Course Outline Traditional Static Program Analysis –Theory Compiler Optimizations; Control Flow Graphs Data-flow Analysis – today’s class –Classic analyses.
Control-Flow Graphs & Dataflow Analysis CS153: Compilers Greg Morrisett.
CS412/413 Introduction to Compilers Radu Rugina Lecture 37: DU Chains and SSA Form 29 Apr 02.
School of EECS, Peking University “Advanced Compiler Techniques” (Fall 2011) Dataflow Analysis Introduction Guo, Yao Part of the slides are adapted from.
1 Data flow analysis Goal : collect information about how a procedure manipulates its data This information is used in various optimizations For example,
Hastings Purify: Fast Detection of Memory Leaks and Access Errors.
6/9/2015© Hal Perkins & UW CSEU-1 CSE P 501 – Compilers SSA Hal Perkins Winter 2008.
1 CS 201 Compiler Construction Lecture 5 Code Optimizations: Copy Propagation & Elimination.
Next Section: Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis (Wilson & Lam) –Unification.
1 Data flow analysis Goal : –collect information about how a procedure manipulates its data This information is used in various optimizations –For example,
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
Fast Effective Dynamic Compilation Joel Auslander, Mathai Philipose, Craig Chambers, etc. PLDI’96 Department of Computer Science and Engineering Univ.
Global optimization. Data flow analysis To generate better code, need to examine definitions and uses of variables beyond basic blocks. With use- definition.
9. Optimization Marcus Denker. 2 © Marcus Denker Optimization Roadmap  Introduction  Optimizations in the Back-end  The Optimizer  SSA Optimizations.
Code Generation Professor Yihjia Tsai Tamkang University.
Lecture 6 Program Flow Analysis Forrest Brewer Ryan Kastner Jose Amaral.
Range Analysis. Intraprocedural Points-to Analysis Want to compute may-points-to information Lattice:
Class canceled next Tuesday. Recap: Components of IR Control dependencies: sequencing of operations –evaluation of if & then –side-effects of statements.
Intraprocedural Points-to Analysis Flow functions:
U NIVERSITY OF M ASSACHUSETTS, A MHERST D EPARTMENT OF C OMPUTER S CIENCE Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
Comparison Caller precisionCallee precisionCode bloat Inlining context-insensitive interproc Context sensitive interproc Specialization.
Lecture 1CS 380C 1 380C Last Time –Course organization –Read Backus et al. Announcements –Hadi lab Q&A Wed 1-2 in Painter 5.38N –UT Texas Learning Center:
Machine-Independent Optimizations Ⅰ CS308 Compiler Theory1.
Composing Dataflow Analyses and Transformations Sorin Lerner (University of Washington) David Grove (IBM T.J. Watson) Craig Chambers (University of Washington)
Ben Livshits Based in part of Stanford class slides from
Pointer analysis. Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis Andersen and.
Optimizing Compilers Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University.
1 CS 201 Compiler Construction Data Flow Analysis.
1 CS 201 Compiler Construction Introduction. 2 Instructor Information Rajiv Gupta Office: WCH Room Tel: (951) Office.
University of Amsterdam Computer Systems – optimizing program performance Arnoud Visser 1 Computer Systems Optimizing program performance.
Static Single Assignment Form in the COINS Compiler Infrastructure Masataka Sassa, Toshiharu Nakaya, Masaki Kohama, Takeaki Fukuoka and Masahito Takahashi.
Lecture 3 Classes, Structs, Enums Passing by reference and value Arrays.
C++ Pointers Review. Overview  What is a pointer  Why do I care?  What can be 'pointed to'?  Example.
1 Data Flow Analysis Data flow analysis is used to collect information about the flow of data values across basic blocks. Dominator analysis collected.
Compiler Optimizations ECE 454 Computer Systems Programming Topics: The Role of the Compiler Common Compiler (Automatic) Code Optimizations Cristiana Amza.
D A C U C P Speculative Alias Analysis for Executable Code Manel Fernández and Roger Espasa Computer Architecture Department Universitat Politècnica de.
CS412/413 Introduction to Compilers and Translators April 2, 1999 Lecture 24: Introduction to Optimization.
Optimization Simone Campanoni
Code Optimization Data Flow Analysis. Data Flow Analysis (DFA)  General framework  Can be used for various optimization goals  Some terms  Basic block.
CS 412/413 Spring 2005Introduction to Compilers1 CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 30: Loop Optimizations and Pointer Analysis.
Code Optimization More Optimization Techniques. More Optimization Techniques  Loop optimization  Code motion  Strength reduction for induction variables.
Detecting Type-Based Alias Analysis Violations in C Iain Ireland (University of Alberta) Jose Nelson Amaral (University of Alberta) Raul Silvera (IBM Canada)
Code Optimization Code produced by compilation algorithms can often be improved (ideally optimized) in terms of run-time speed and the amount of memory.
Code Optimization.
Data Flow Analysis Suman Jana
Simone Campanoni Dependences Simone Campanoni
Advanced Compilers CMPSCI 710 Spring 2003 Lecture 1
Topic 17: Memory Analysis
Common Subexpression Elimination
Common Subexpression Elimination and Copy Propagation in Titanium
Topic 10: Dataflow Analysis
Programming Languages (CS 550) Mini Language Compiler
Code Generation Part III
University Of Virginia
Unit-1 Introduction to Java
Code Generation Part III
Static Single Assignment Form (SSA)
Pointer analysis.
9. Optimization Marcus Denker.
Optimizing Compilers CISC 673 Spring 2009 Course Overview
Programming Languages (CS 360) Mini Language Compiler
Presentation transcript:

1 May-Alias Analysis for L3 David Abraham, Elisabeth Crawford, Sue Ann Hong, and Virginia Vassilevska

2 Introduction What does alias mean?  Two pointers alias each other if both point to the same memory location What is alias analysis?  Determining what each pointer references, so we can tell if two pointers alias each other Why is alias analysis useful?  Many code optimizations are overly conservative without alias information pq memory

3 Use of Alias-Analysis BEFORE a = mem(p) mem(q) = b c = mem(p) d = a + c Is q an alias of p?  Yes or Don’t Know: mem(q) store kills availability of mem(p)  No: apply common sub-expression elimination, and then copy propagation AFTER 1. a = mem(p) 2. mem(q) = b 3. d = a + a

4 May-Alias Analysis Can’t statically track what each pointer refers to exactly So be conservative - track what each pointer may refer to p, q may alias each other if they may refer to same memory location

5 Some May-Alias Rules Let alias(q) = set of memory locations that q may alias statementalias(p) = p = qalias(q) p = q + c, where c is a const {loc + c : loc in alias(q)} p = function(…){all memory locations} s: p = alloc(), where s is an internal label of this statement alias(p) = {s}

6 May-Alias Dataflow Analysis For each statement s:  IN(s) = alias information for each pointer on entry to s  OUT(s) = alias information for each pointer on exit from s IN(s)=union p OUT(p), where p is predecessor of s OUT = IN with statement rule applied

7 Experimental Setup L3 Test Suite:  Correctness tests (not reported here)  Big directory performance tests Tested combinations of optimizations to identify performance gains and hits KeyTranslation REFReference 3ADRThree-Address Code CFConstant Folding CTPConst Propagation CSECommon Subexpression Elimination CPPCopy Propagation

8 Runtime Results

9 More Runtime Results

10 Code Transformation Results

11 Conclusions Alias analysis can greatly increase the effectiveness of optimizations, in terms of:  Runtime performance  Temp usage Alias analysis works best in tandem with copy propagation Alias analysis is expensive; performance payoffs may not be worthwhile in a JIT compiler

12 Bibliography 1. Modern Compiler Implementation in ML, Appel 2. On the importance of points-to-analysis and other memory disambiguation methods for C programs, Ghiya, Lavery, and Sehr 3. An improved intra-procedural may-alias analysis algorithm, Goyal 4. Advanced Compiler Design and Implementation, Muchnick 5. Survey of Alias Analysis, Wu