120 likes | 321 Views
May-Alias Analysis for L3. David Abraham, Elisabeth Crawford, Sue Ann Hong, and Virginia Vassilevska. Introduction. What does alias mean? Two pointers alias each other if both point to the same memory location What is alias analysis ?
E N D
May-Alias Analysis for L3 David Abraham, Elisabeth Crawford, Sue Ann Hong, and Virginia Vassilevska
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 memory p q
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 a = mem(p) mem(q) = b d = a + a Use of Alias-Analysis
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
Some May-Alias Rules • Let alias(q) = set of memory locations that q may alias
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)=unionpOUT(p), where p is predecessor of s • OUT = IN with statement rule applied
Experimental Setup • L3 Test Suite: • Correctness tests (not reported here) • Big directory performance tests • Tested combinations of optimizations to identify performance gains and hits
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
Bibliography • Modern Compiler Implementation in ML, Appel • On the importance of points-to-analysis and other memory disambiguation methods for C programs, Ghiya, Lavery, and Sehr • An improved intra-procedural may-alias analysis algorithm, Goyal • Advanced Compiler Design and Implementation, Muchnick • Survey of Alias Analysis, Wu