{"title":"基于词法的部分冗余消除:一种提高效率的优化算法","authors":"Reshma Roy, Vineeth Paleri","doi":"10.1016/j.cola.2023.101204","DOIUrl":null,"url":null,"abstract":"<div><p>Partial redundancy elimination is a well-known optimization in compilers that eliminates the recomputation of equivalent expressions appearing on a path in a program. Morel and Renvoise, in their seminal paper, showed that it is a powerful optimization that subsumes two traditional optimizations, i.e., Common Subexpression Elimination and Loop Invariant Code Motion. Morel and Renvoise’s algorithm is not computationally optimal because partially redundant computations may remain even after the optimization. Later, Knoop et al. came up with an algorithm that is computationally and lifetime optimal. The algorithm by Knoop et al. takes four unidirectional data flow analyses to perform the transformation. Here, we propose a new algorithm for partial redundancy elimination, both computationally and lifetime optimal. The proposed algorithm is more efficient than other best-known algorithms since it takes only three unidirectional data flow analyses. We demonstrate the efficiency of the proposed algorithm by implementing it using the LLVM Compiler Infrastructure and comparing the time taken by the algorithm with other selected best-known algorithms. The proposed algorithm reported here is based on lexically equivalent expressions. However, we believe that the ideas in the proposed algorithm can find their use in the value-based approach.</p></div>","PeriodicalId":48552,"journal":{"name":"Journal of Computer Languages","volume":"75 ","pages":"Article 101204"},"PeriodicalIF":1.7000,"publicationDate":"2023-06-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Lexical-based partial redundancy elimination: An optimal algorithm with improved efficiency\",\"authors\":\"Reshma Roy, Vineeth Paleri\",\"doi\":\"10.1016/j.cola.2023.101204\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"<div><p>Partial redundancy elimination is a well-known optimization in compilers that eliminates the recomputation of equivalent expressions appearing on a path in a program. Morel and Renvoise, in their seminal paper, showed that it is a powerful optimization that subsumes two traditional optimizations, i.e., Common Subexpression Elimination and Loop Invariant Code Motion. Morel and Renvoise’s algorithm is not computationally optimal because partially redundant computations may remain even after the optimization. Later, Knoop et al. came up with an algorithm that is computationally and lifetime optimal. The algorithm by Knoop et al. takes four unidirectional data flow analyses to perform the transformation. Here, we propose a new algorithm for partial redundancy elimination, both computationally and lifetime optimal. The proposed algorithm is more efficient than other best-known algorithms since it takes only three unidirectional data flow analyses. We demonstrate the efficiency of the proposed algorithm by implementing it using the LLVM Compiler Infrastructure and comparing the time taken by the algorithm with other selected best-known algorithms. The proposed algorithm reported here is based on lexically equivalent expressions. However, we believe that the ideas in the proposed algorithm can find their use in the value-based approach.</p></div>\",\"PeriodicalId\":48552,\"journal\":{\"name\":\"Journal of Computer Languages\",\"volume\":\"75 \",\"pages\":\"Article 101204\"},\"PeriodicalIF\":1.7000,\"publicationDate\":\"2023-06-01\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Journal of Computer Languages\",\"FirstCategoryId\":\"94\",\"ListUrlMain\":\"https://www.sciencedirect.com/science/article/pii/S259011842300014X\",\"RegionNum\":3,\"RegionCategory\":\"计算机科学\",\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"Q3\",\"JCRName\":\"COMPUTER SCIENCE, SOFTWARE ENGINEERING\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Journal of Computer Languages","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S259011842300014X","RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
Lexical-based partial redundancy elimination: An optimal algorithm with improved efficiency
Partial redundancy elimination is a well-known optimization in compilers that eliminates the recomputation of equivalent expressions appearing on a path in a program. Morel and Renvoise, in their seminal paper, showed that it is a powerful optimization that subsumes two traditional optimizations, i.e., Common Subexpression Elimination and Loop Invariant Code Motion. Morel and Renvoise’s algorithm is not computationally optimal because partially redundant computations may remain even after the optimization. Later, Knoop et al. came up with an algorithm that is computationally and lifetime optimal. The algorithm by Knoop et al. takes four unidirectional data flow analyses to perform the transformation. Here, we propose a new algorithm for partial redundancy elimination, both computationally and lifetime optimal. The proposed algorithm is more efficient than other best-known algorithms since it takes only three unidirectional data flow analyses. We demonstrate the efficiency of the proposed algorithm by implementing it using the LLVM Compiler Infrastructure and comparing the time taken by the algorithm with other selected best-known algorithms. The proposed algorithm reported here is based on lexically equivalent expressions. However, we believe that the ideas in the proposed algorithm can find their use in the value-based approach.