Abstract
Context-sensitive inter-procedural alias analyses are more precise than intra-procedural alias analyses. However, context-sensitive inter-procedural alias analyses are not scalable. As a consequence, most of the production compilers sacrifice precision for scalability and implement intra-procedural alias analysis. The alias analysis is used by many compiler optimizations, including loop transformations. Due to the imprecision of alias analysis, the program’s performance may suffer, especially in the presence of loops.
Previous work proposed a general approach based on code-versioning with dynamic checks to disambiguate pointers at runtime. However, the overhead of dynamic checks in this approach is O(log n), which is substantially high to enable interesting optimizations. Other suggested approaches, e.g., polyhedral and symbolic range analysis, have O(1) overheads, but they only work for loops with certain constraints. The production compilers, such as LLVM and GCC, use scalar evolution analysis to compute an O(1) range check for loops to resolve memory dependencies at runtime. However, this approach also can only be applied to loops with certain constraints.
In this work, we present our tool, Scout, that can disambiguate two pointers at runtime using single memory access. Scout is based on the key idea to constrain the allocation size and alignment during memory allocations. Scout can also disambiguate array accesses within a loop for which the existing O(1) range checks technique cannot be applied. In addition, Scout uses feedback from static optimizations to reduce the number of dynamic checks needed for optimizations.
Our technique enabled new opportunities for loop-invariant code motion, dead store elimination, loop vectorization, and load elimination in an already optimized code. Our performance improvements are up to 51.11% for Polybench and up to 0.89% for CPU SPEC 2017 suites. The geometric means for our allocator’s CPU and memory overheads for CPU SPEC 2017 benchmarks are 1.05%, and 7.47%, respectively. For Polybench benchmarks, the geometric mean of CPU and memory overheads are 0.21% and 0.13%, respectively.
- 2016 (accessed Apr 14, 2022). Intel 64 and ia-32 architectures software developer’s manual volume 2b. https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-2b-manual.pdf
Google Scholar
- 2019 (accessed Apr 13, 2022). Restrict Keyword in LLVM. https://lists.llvm.org/pipermail/llvm-dev/2019-March/131127.html
Google Scholar
- 2021 (accessed Apr 13, 2022). CPU SPEC 2017 benchmark suite. https://www.spec.org/cpu2017/Docs/overview.html##benchmarks
Google Scholar
- 2022 (accessed Apr 13, 2022). Intrinsic Functions. https://llvm.org/docs/LangRef.html##intrinsic-functions
Google Scholar
- 2022 (accessed Apr 13, 2022). Runtime Checks of Pointers. https://llvm.org/docs/Vectorizers.html##runtime-checks-of-pointers
Google Scholar
- 2022 (accessed Apr 13, 2022). ‘noalias’ and ‘alias.scope’ Metadata. https://llvm.org/docs/LangRef.html##noalias-and-alias-scope-metadata
Google Scholar
- 2022 (accessed Sep 9, 2022). Scout Artifact DOI. https://doi.org/10.5281/zenodo.7089827
Google Scholar
Digital Library
- 2022 (accessed Sep 9, 2022). Scout Artifact Github Repository. https://github.com/khushboochitre/Scout-Artifact.git
Google Scholar
- Péricles Alves, Fabian Gruber, Johannes Doerfert, Alexandros Lamprineas, Tobias Grosser, Fabrice Rastello, and Fernando Magno Quintão Pereira. 2015. Runtime Pointer Disambiguation. In Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2015). Association for Computing Machinery, New York, NY, USA. 589–606. isbn:9781450336895 https://doi.org/10.1145/2814270.2814285
Google Scholar
Digital Library
- Lars Ole Andersen and Peter Lee. 2005. Program Analysis and Specialization for the C Programming Language.
Google Scholar
- Marc Berndl, Ondrej Lhoták, Feng Qian, Laurie Hendren, and Navindra Umanee. 2003. Points-to analysis using BDDs. ACM SIGPLAN Notices, 38, 5 (2003), 103–114.
Google Scholar
Digital Library
- Uday Bondhugula, Albert Hartono, J. Ramanujam, and P. Sadayappan. 2008. A Practical Automatic Polyhedral Parallelizer and Locality Optimizer. In Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’08). Association for Computing Machinery, New York, NY, USA. 101–113. isbn:9781595938602 https://doi.org/10.1145/1375581.1375595
Google Scholar
Digital Library
- James Bucek, Klaus-Dieter Lange, and Jóakim v. Kistowski. 2018. SPEC CPU2017: Next-generation compute benchmark. In Companion of the 2018 ACM/SPEC International Conference on Performance Engineering. 41–42. https://doi.org/10.1145/3185768.3185771
Google Scholar
Digital Library
- Tong Chen, Jin Lin, Xiaoru Dai, Wei-Chung Hsu, and Pen-Chung Yew. 2004. Data dependence profiling for speculative optimizations. In International Conference on Compiler Construction. 57–72. https://doi.org/10.1007/978-3-540-24723-4_5
Google Scholar
Cross Ref
- Fred Chow, Sun Chan, Robert Kennedy, Shin-Ming Liu, Raymond Lo, and Peng Tu. 1997. A New Algorithm for Partial Redundancy Elimination Based on SSA Form. In Proceedings of the ACM SIGPLAN 1997 Conference on Programming Language Design and Implementation (PLDI ’97). Association for Computing Machinery, New York, NY, USA. 273–286. isbn:0897919076 https://doi.org/10.1145/258915.258940
Google Scholar
Digital Library
- K. D. Cooper and K. Kennedy. 1989. Fast Interprocedual Alias Analysis. In Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’89). Association for Computing Machinery, New York, NY, USA. 49–59. isbn:0897912942 https://doi.org/10.1145/75277.75282
Google Scholar
Digital Library
- Jeff Da Silva and J. Gregory Steffan. 2006. A Probabilistic Pointer Analysis for Speculative Optimizations. In Proceedings of the 12th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS XII). Association for Computing Machinery, New York, NY, USA. 416–425. isbn:1595934510 https://doi.org/10.1145/1168857.1168908
Google Scholar
Digital Library
- Amer Diwan, Kathryn S. McKinley, and J. Eliot B. Moss. 1998. Type-Based Alias Analysis. In Proceedings of the ACM SIGPLAN 1998 Conference on Programming Language Design and Implementation (PLDI ’98). Association for Computing Machinery, New York, NY, USA. 106–117. isbn:0897919874 https://doi.org/10.1145/277650.277670
Google Scholar
Digital Library
- Johannes Doerfert, Tobias Grosser, and Sebastian Hack. 2017. Optimistic loop optimization. In 2017 IEEE/ACM International Symposium on Code Generation and Optimization (CGO). 292–304.
Google Scholar
Cross Ref
- Paul Feautrier. 1992. Some efficient solutions to the affine scheduling problem. I. One-dimensional time. International journal of parallel programming, 21, 5 (1992), 313–347. https://doi.org/10.1007/BF01407835
Google Scholar
Digital Library
- Manel Fernández and Roger Espasa. 2002. Speculative Alias Analysis for Executable Code. In Proceedings of the 2002 International Conference on Parallel Architectures and Compilation Techniques (PACT ’02). IEEE Computer Society, USA. 222–231. isbn:0769516203
Google Scholar
Digital Library
- Ben Hardekopf and Calvin Lin. 2007. The Ant and the Grasshopper: Fast and Accurate Pointer Analysis for Millions of Lines of Code. In Proceedings of the 28th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’07). Association for Computing Machinery, New York, NY, USA. 290–299. isbn:9781595936332 https://doi.org/10.1145/1250734.1250767
Google Scholar
Digital Library
- Ben Hardekopf and Calvin Lin. 2009. Semi-Sparse Flow-Sensitive Pointer Analysis. In Proceedings of the 36th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’09). Association for Computing Machinery, New York, NY, USA. 226–238. isbn:9781605583792 https://doi.org/10.1145/1480881.1480911
Google Scholar
Digital Library
- Ben Hardekopf and Calvin Lin. 2011. Flow-sensitive pointer analysis for millions of lines of code. In International Symposium on Code Generation and Optimization (CGO 2011). 289–298. https://doi.org/10.1109/CGO.2011.5764696
Google Scholar
Cross Ref
- Michael Hind, Michael Burke, Paul Carini, and Jong-Deok Choi. 1999. Interprocedural Pointer Alias Analysis. ACM Trans. Program. Lang. Syst., 21, 4 (1999), July, 848–894. issn:0164-0925 https://doi.org/10.1145/325478.325519
Google Scholar
Digital Library
- A. S. Huang, G. Slavenburg, and J. P. Shen. 1994. Speculative Disambiguation: A Compilation Technique for Dynamic Memory Disambiguation. In Proceedings of the 21st Annual International Symposium on Computer Architecture (ISCA ’94). IEEE Computer Society Press, Washington, DC, USA. 200–210. isbn:0818655100 https://doi.org/10.1145/192007.192012
Google Scholar
Digital Library
- S. Jaiswal, Uday P. Khedker, and Supratik Chakraborty. 2018. Demand-driven Alias Analysis : Formalizing Bidirectional Analyses for Soundness and Precision. ArXiv, abs/1802.00932 (2018).
Google Scholar
- Ralf Karrenberg and Sebastian Hack. 2011. Whole-Function Vectorization. In Proceedings of the 9th Annual IEEE/ACM International Symposium on Code Generation and Optimization (CGO ’11). IEEE Computer Society, USA. 141–150. isbn:9781612843568
Google Scholar
Digital Library
- W LANDI. 1992. Undecidahility of static analysis. 1992. Lett. Program. Lang. Syst, 1, 4 (1992), https://doi.org/10.1145/161494.161501
Google Scholar
Digital Library
- Chris Lattner, Andrew Lenharth, and Vikram Adve. 2007. Making Context-Sensitive Points-to Analysis with Heap Cloning Practical for the Real World. In Proceedings of the 28th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’07). Association for Computing Machinery, New York, NY, USA. 278–289. isbn:9781595936332 https://doi.org/10.1145/1250734.1250766
Google Scholar
Digital Library
- Jin Lin, Tong Chen, Wei-Chung Hsu, Pen-Chung Yew, Roy Dz-Ching Ju, Tin-Fook Ngai, and Sun Chan. 2003. A Compiler Framework for Speculative Analysis and Optimizations. In Proceedings of the ACM SIGPLAN 2003 Conference on Programming Language Design and Implementation (PLDI ’03). Association for Computing Machinery, New York, NY, USA. 289–299. isbn:1581136625 https://doi.org/10.1145/781131.781164
Google Scholar
Digital Library
- Vitaliy B Lvin, Gene Novark, Emery D Berger, and Benjamin G Zorn. 2008. Archipelago: trading address space for reliability and security. ACM SIGARCH Computer Architecture News, 36, 1 (2008), 115–124.
Google Scholar
Digital Library
- Dorit Naishlos. 2004. Autovectorization in GCC. In Proceedings of the 2004 GCC Developers Summit. 105–118.
Google Scholar
- Henrique Nazaré, Izabela Maffra, Willer Santos, Leonardo Barbosa, Laure Gonnord, and Fernando Magno Quintão Pereira. 2014. Validation of Memory Accesses through Symbolic Analyses. SIGPLAN Not., 49, 10 (2014), Oct., 791–809. issn:0362-1340 https://doi.org/10.1145/2714064.2660205
Google Scholar
Digital Library
- Vitor Paisante, Maroua Maalej, Leonardo Barbosa, Laure Gonnord, and Fernando Magno Quintão Pereira. 2016. Symbolic range analysis of pointers. In 2016 IEEE/ACM International Symposium on Code Generation and Optimization (CGO). 171–181. https://doi.org/10.1145/2854038.2854050
Google Scholar
Digital Library
- David J. Pearce, Paul H.J. Kelly, and Chris Hankin. 2007. Efficient Field-Sensitive Pointer Analysis of C. ACM Trans. Program. Lang. Syst., 30, 1 (2007), Nov., 4–es. issn:0164-0925 https://doi.org/10.1145/1290520.1290524
Google Scholar
Digital Library
- Ganesan Ramalingam. 1994. The undecidability of aliasing. ACM Transactions on Programming Languages and Systems (TOPLAS), 16, 5 (1994), 1467–1471. https://doi.org/10.1145/186025.186041
Google Scholar
Digital Library
- Radu Rugina and Martin Rinard. 2000. Symbolic bounds analysis of pointers, array indices, and accessed memory regions. ACM Sigplan Notices, 35, 5 (2000), 182–195. https://doi.org/10.1145/358438.349325
Google Scholar
Digital Library
- Diogo N. Sampaio, Louis-Noël Pouchet, and Fabrice Rastello. 2017. Simplification and Runtime Resolution of Data Dependence Constraints for Loop Transformations. In Proceedings of the International Conference on Supercomputing (ICS ’17). Association for Computing Machinery, New York, NY, USA. Article 10, 11 pages. isbn:9781450350204 https://doi.org/10.1145/3079079.3079098
Google Scholar
Digital Library
- Marc Shapiro and Susan Horwitz. 1997. The Effects of the Precision of Pointer Analysis. In Proceedings of the 4th International Symposium on Static Analysis (SAS ’97). Springer-Verlag, Berlin, Heidelberg. 16–34. isbn:3540634681
Google Scholar
Digital Library
- Victor Hugo Sperle Campos, Péricles Rafael Alves, Henrique Nazaré Santos, and Fernando Magno Quintão Pereira. 2016. Restrictification of Function Arguments. In Proceedings of the 25th International Conference on Compiler Construction (CC 2016). Association for Computing Machinery, New York, NY, USA. 163–173. isbn:9781450342414 https://doi.org/10.1145/2892208.2892225
Google Scholar
Digital Library
- Bjarne Steensgaard. 1996. Points-to Analysis in Almost Linear Time. In Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’96). Association for Computing Machinery, New York, NY, USA. 32–41. isbn:0897917693 https://doi.org/10.1145/237721.237727
Google Scholar
Digital Library
- Rishi Surendran, Rajkishore Barik, Jisheng Zhao, and Vivek Sarkar. 2014. Inter-iteration Scalar Replacement Using Array SSA Form. In CC.
Google Scholar
- R Van Engelen. 2000. Symbolic evaluation of chains of recurrences for loop optimization. Citeseer.
Google Scholar
- Robert A Van Engelen. 2001. Efficient symbolic analysis for optimizing compilers. In International Conference on Compiler Construction. 118–132.
Google Scholar
Cross Ref
- John Whaley and Monica S Lam. 2004. Cloning-based context-sensitive pointer alias analysis using binary decision diagrams. In Proceedings of the ACM SIGPLAN 2004 conference on Programming Language Design and Implementation. 131–144. https://doi.org/10.1145/996841.996859
Google Scholar
Digital Library
- Xin Zheng and Radu Rugina. 2008. Demand-driven alias analysis for C. In Proceedings of the 35th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages. 197–208. https://doi.org/10.1145/1328897.1328464
Google Scholar
Digital Library
- Jianwen Zhu. 2005. Towards scalable flow and context sensitive pointer analysis. In Proceedings. 42nd Design Automation Conference, 2005.. 831–836. https://doi.org/10.1145/1065579.1065798
Google Scholar
Digital Library
Index Terms
The road not taken: exploring alias analysis based optimizations missed by the compiler
Recommendations
Precise flow-insensitive may-alias analysis is NP-hard
Determining aliases is one of the foundamental static analysis problems, in part because the precision with which this problem is solved can affect the precision of other analyses such as live variables, available expressions, and constant propagation. ...
Demand-driven alias analysis for C
POPL '08This paper presents a demand-driven, flow-insensitive analysisalgorithm for answering may-alias queries. We formulate thecomputation of alias queries as a CFL-reachability problem, and use this formulation to derive a demand-driven analysis algorithm. ...
Demand-driven alias analysis for C
POPL '08: Proceedings of the 35th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesThis paper presents a demand-driven, flow-insensitive analysisalgorithm for answering may-alias queries. We formulate thecomputation of alias queries as a CFL-reachability problem, and use this formulation to derive a demand-driven analysis algorithm. ...






Comments