Skip to main content

Genetic Improvement of LLVM Intermediate Representation

  • Conference paper
  • First Online:
Genetic Programming (EuroGP 2023)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13986))

Included in the following conference series:

Abstract

Evolving LLVM IR is widely applicable, with LLVM Clang offering support for an increasing range of computer hardware and programming languages. Local search mutations are used to hill climb industry C code released to support geographic open standards: Open Location Code (OLC) from Google and Uber’s Hexagonal Hierarchical Spatial Index (H3), giving up to two percent speed up on compiler optimised code.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 64.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 84.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    In [38] we used a similar idea to test if mutated code is identical by inspecting X86 assembler generated by the GNU gcc compiler. Also Mike Papadakis et al. [39] compared compiler output to look for equivalent mutants.

  2. 2.

    https://github.com/google/open-location-code downloaded 4 August 2022.

  3. 3.

    https://github.com/uber/h3 downloaded 3 August 2022.

  4. 4.

    https://www.getthedata.com/downloads/open_postcode_geo.csv.zip dated 16 March 2022. The data are alphabetically sorted starting with AB1 0AA, which is in Aberdeen.

  5. 5.

    Mutable conditional br instructions give rise to two mutations per line, Sect. 3.1.

  6. 6.

    Our LLVM IR representation allows ready calculation of how many lines of LLVM IR are impacted, as an alternative to counting the number of mutations.

References

  1. Petke, J., et al.: Genetic improvement of software: a comprehensive survey. IEEE TEVC 22(3), 415–432 (2018). https://doi.org/10.1109/TEVC.2017.2693219

    Article  Google Scholar 

  2. Langdon, W.B., Harman, M.: Evolving a CUDA kernel from an nVidia template. In: Sobrevilla, P. (ed.) WCCI, pp. 2376–2383 (2010). https://doi.org/10.1109/CEC.2010.5585922

  3. Harman, M., Jones, B.F.: Search based software engineering. Inf. Softw. Technol. 43(14), 833–839 (2001). https://doi.org/10.1016/S0950-5849(01)00189-6

    Article  Google Scholar 

  4. Poli, R., Langdon, W.B., McPhee, N.F.: A field guide to genetic programming. Published via http://lulu.com and freely available at http://www.gp-field-guide.org.uk (2008). http://www.gp-field-guide.org.uk

  5. Marginean, A., Barr, E.T., Harman, M., Jia, Y.: Automated transplantation of call graph and layout features into Kate. In: Barros, M., Labiche, Y. (eds.) SSBSE 2015. LNCS, vol. 9275, pp. 262–268. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-22183-0_21

    Chapter  Google Scholar 

  6. Marginean, A.: Automated software transplantation. Ph.D. thesis, University College London (2021). https://discovery.ucl.ac.uk/id/eprint/10137954/1/Marginean_10137954_thesis_redacted.pdf

  7. Langdon, W.B., Harman, M.: Optimising existing software with genetic programming. IEEE TEVC 19(1), 118–135 (2015). https://doi.org/10.1109/TEVC.2013.2281544

    Article  Google Scholar 

  8. Weimer, W., Nguyen, T., Le Goues, C., Forrest, S.: Automatically finding patches using genetic programming. In: Fickas, S. (ed.) ICSE, pp. 364–374 (2009). https://doi.org/10.1109/ICSE.2009.5070536

  9. Weimer, W., Forrest, S., Le Goues, C., Nguyen, T.: Automatic program repair with evolutionary computation. Commun. ACM 53(5), 109–116 (2010). https://doi.org/10.1145/1735223.1735249

    Article  Google Scholar 

  10. Haraldsson, S.O., Woodward, J.R., Brownlee, A.E.I., Siggeirsdottir, K.: Fixing bugs in your sleep: how genetic improvement became an overnight success. In: Petke, J., White, D.R., Langdon, W.B., Weimer, W. (eds.) GI-2017, pp. 1513–1520 (2017). https://doi.org/10.1145/3067695.3082517

  11. Le Goues, C., Pradel, M., Roychoudhury, A.: Automated program repair. Commun. ACM 62(12), 56–65 (2019). https://doi.org/10.1145/3318162

    Article  Google Scholar 

  12. Monperrus, M.: Automatic software repair: a bibliography. ACM Comput. Surv. 51(1), Article no. 17 (2018). https://doi.org/10.1145/3105906

  13. Alshahwan, N.: Industrial experience of genetic improvement in Facebook. In: Petke, J., Tan, S.H., Langdon, W.B., Weimer, W. (eds.) GI-2019, ICSE Workshops Proceedings, p. 1 (2019). https://doi.org/10.1109/GI.2019.00010

  14. Harman, M.: Scaling genetic improvement and automated program repair. In: Kechagia, M., Tan, S.H., Mechtaev, S., Tan, L. (eds.) International Workshop on Automated Program Repair (APR 2022) (2022). https://doi.org/10.1145/3524459.3527353

  15. Kirbas, S., et al.: On the introduction of automatic program repair in Bloomberg. IEEE Softw. 38(4), 43–51 (2021). https://doi.org/10.1109/MS.2021.3071086

    Article  Google Scholar 

  16. Kechagia, M., Tan, S.H., Mechtaev, S., Tan, L. (eds.): 2022 IEEE/ACM International Workshop on Automated Program Repair (APR) (2022). https://ieeexplore.ieee.org/xpl/conhome/9474454/proceeding

  17. Callan, J., Krauss, O., Petke, J., Sarro, F.: How do Android developers improve non-functional properties of software? Empr. Soft. Eng. 27, Article no. 113 (2022). https://doi.org/10.1007/s10664-022-10137-2

  18. Langdon, W.B., Harman, M.: Genetically improved CUDA C++ software. In: Nicolau, M., et al. (eds.) EuroGP 2014. LNCS, vol. 8599, pp. 87–99. Springer, Heidelberg (2014). https://doi.org/10.1007/978-3-662-44303-3_8

    Chapter  Google Scholar 

  19. Langdon, W.B., Modat, M., Petke, J., Harman, M.: Improving 3D medical image registration CUDA software with genetic programming. In: Igel, C., et al. (eds.) GECCO, pp. 951–958 (2014). https://doi.org/10.1145/2576768.2598244

  20. Langdon, W.B., Harman, M.: Grow and graft a better CUDA pknotsRG for RNA pseudoknot free energy calculation. In: Langdon, W.B., Petke, J., White, D.R. (eds.) GI, pp. 805–810 (2015). https://doi.org/10.1145/2739482.2768418

  21. Langdon, W.B., Lam, B.Y.H., Modat, M., Petke, J., Harman, M.: Genetic improvement of GPU software. Genet. Program Evolvable Mach. 18(1), 5–44 (2016). https://doi.org/10.1007/s10710-016-9273-9

    Article  Google Scholar 

  22. Klus, P., et al.: BarraCUDA - a fast short read sequence aligner using graphics processing units. BMC Res. Notes 5(27) (2012). https://doi.org/10.1186/1756-0500-5-27

  23. Langdon, W.B., Lam, B.Y.H.: Genetically improved BarraCUDA. BioData Min. 20(28) (2017). https://doi.org/10.1186/s13040-017-0149-1

  24. Langdon, W.B., Lorenz, R.: Evolving AVX512 parallel C code using GP. In: Sekanina, L., Hu, T., Lourenço, N., Richter, H., García-Sánchez, P. (eds.) EuroGP 2019. LNCS, vol. 11451, pp. 245–261. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-16670-0_16

    Chapter  Google Scholar 

  25. Lorenz, R., et al.: ViennaRNA package 2.0. Algorithms Mol. Biol. 6(1) (2011). https://doi.org/10.1186/1748-7188-6-26

  26. Andrews, R.J., et al.: A map of the SARS-CoV-2 RNA structurome. NAR Genom. Bioinform. 3(2), lqab043 (2021). https://doi.org/10.1093/nargab/lqab043

  27. Lewis, T.E., Magoulas, G.D.: TMBL kernels for CUDA GPUs compile faster using PTX. In: Harding, S., et al. (eds.) GECCO, pp. 455–462 (2011). https://doi.org/10.1145/2001858.2002033

  28. Liou, J.Y., Forrest, S., Wu, C.-J.: Genetic improvement of GPU code. In: Petke, J., Tan, S.H., Langdon, W.B., Weimer, W. (eds.) GI-2019, ICSE Workshops Proceedings, pp. 20–27 (2019). https://doi.org/10.1109/GI.2019.00014

  29. Liou, J.Y., Wang, X., Forrest, S., Wu, C.J.: GEVO: GPU code optimization using evolutionary computation. ACM Trans. Archit. Code Optim. 17(4), Article no. 33 (2020). https://doi.org/10.1145/3418055

  30. Liou, J.Y., et al.: Understanding the power of evolutionary computation for GPU code optimization. arXiv (2022). https://doi.org/10.48550/ARXIV.2208.12350

  31. Ryan, C., Collins, J.J., Neill, M.O.: Grammatical evolution: evolving programs for an arbitrary language. In: Banzhaf, W., Poli, R., Schoenauer, M., Fogarty, T.C. (eds.) EuroGP 1998. LNCS, vol. 1391, pp. 83–96. Springer, Heidelberg (1998). https://doi.org/10.1007/BFb0055930

    Chapter  Google Scholar 

  32. Li, S.S., et al.: Genetic improvement in the Shackleton framework for optimizing LLVM pass sequences. In: Bruce, B.R., et al. (eds.) GECCO, pp. 1938–1939. Association for Computing Machinery (2022). https://doi.org/10.1145/3520304.3534000

  33. Peeler, H., et al.: Optimizing LLVM pass sequences with Shackleton: a linear genetic programming framework. In: Trautmann, H., et al. (eds.) GECCO Comp, GECCO 2022, pp. 578–581. Association for Computing Machinery (2022). https://doi.org/10.1145/3520304.3528945

  34. Peeler, H., et al.: Optimizing LLVM pass sequences with Shackleton: a linear genetic programming framework. arXiv (2022). https://arxiv.org/abs/2201.13305

  35. Brameier, M., Banzhaf, W.: Linear Genetic Programming. No. XVI in Genetic and Evolutionary Computation (2007). https://doi.org/10.1007/978-0-387-31030-5

  36. Petke, J., et al.: A survey of genetic improvement search spaces. In: Alexander, B., Haraldsson, S.O., Wagner, M., Woodward, J.R. (eds.) GECCO, pp. 1715–1721 (2019). https://doi.org/10.1145/3319619.3326870

  37. Rainford, P., Porter, B.: Using phylogenetic analysis to enhance genetic improvement. In: Rahat, A., et al. (eds.) GECCO, GECCO 2022, pp. 849–857. Association for Computing Machinery (2022). https://doi.org/10.1145/3512290.3528789

  38. Langdon, W.B.: Genetic improvement of genetic programming. In: Brownlee, A.S., Haraldsson, S.O., Petke, J., Woodward, J.R. (eds.) GI @ CEC 2020 Special Session (2020). https://doi.org/10.1109/CEC48606.2020.9185771

  39. Papadakis, M., Jia, Y., Harman, M., Le Traon, Y.: Trivial compiler equivalence: a large scale empirical study of a simple fast and effective equivalent mutant detection technique. In: ICSE (2015). https://pages.cs.aueb.gr/~mpapad/papers/ICSE15B.pdf

  40. Langdon, W.B., Petke, J., Bruce, B.R.: Optimising quantisation noise in energy measurement. In: Handl, J., Hart, E., Lewis, P.R., López-Ibáñez, M., Ochoa, G., Paechter, B. (eds.) PPSN 2016. LNCS, vol. 9921, pp. 249–259. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-45823-6_23

    Chapter  Google Scholar 

  41. Blot, A., Petke, J.: Using genetic improvement to optimise optimisation algorithm implementations. In: Hadj-Hamou, K. (ed.) ROADEF 2022. INSA Lyon (2022). https://www.cs.ucl.ac.uk/staff/a.blot/files/blot_roadef_2022.pdf

  42. Harman, M., Jia, Y., Langdon, W.B.: A manifesto for higher order mutation testing. In: du Bousquet, L., Bradbury, J., Fraser, G. (eds.) Mutation 2010, pp. 80–89 (2010). https://doi.org/10.1109/ICSTW.2010.13

  43. Sitthi-amorn, P., Modly, N., Weimer, W., Lawrence, J.: Genetic programming for shader simplification. ACM Trans. Graph. 30(6), Article no. 152 (2011). https://doi.org/10.1145/2070781.2024186

  44. Langdon, W.B., Veerapen, N., Ochoa, G.: Visualising the search landscape of the triangle program. In: McDermott, J., Castelli, M., Sekanina, L., Haasdijk, E., García-Sánchez, P. (eds.) EuroGP 2017. LNCS, vol. 10196, pp. 96–113. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-55696-3_7

    Chapter  Google Scholar 

Download references

Acknowledgements

We are grateful for help from H.Wierstorf (gnuplot) and F.Pfenning (\(\phi \) nodes). Funded by the Meta Oops project.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to William B. Langdon .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Langdon, W.B., Al-Subaihin, A., Blot, A., Clark, D. (2023). Genetic Improvement of LLVM Intermediate Representation. In: Pappa, G., Giacobini, M., Vasicek, Z. (eds) Genetic Programming. EuroGP 2023. Lecture Notes in Computer Science, vol 13986. Springer, Cham. https://doi.org/10.1007/978-3-031-29573-7_16

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-29573-7_16

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-29572-0

  • Online ISBN: 978-3-031-29573-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics