Original Code Written · 2007
this document, we use the term item to refer to either a register or a memory tag. The basic idea used in constructing SSA form is to give unique names to the targets of all assignments in the routine, and then to overwrite uses of the assignments with the new names. A complication arises in routines with more than one basic block. Values can flow into a block from more than one definition site, and each site has a unique SSA name for the item. Consider the following example: H H H H H H H H H H Hj \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi H H H H H H H H H H Hj
Cited by 0
Original Code · 1993
this document, we use the term item to refer to either a register or a memory tag. The basic idea used in constructing SSA form is to give unique names to the targets of all assignments in the routine, and then to overwrite uses of the assignments with the new names. A complication arises in routines with more than one basic block. Values can flow into a block from more than one definition site, and each site has a unique SSA name for the item. Consider the following example: H H H H H H H H H H Hj \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phiß \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phi \\Phiß H H H H H H H H H H Hj
Cited by 0
Jens Knoop, Oliver Rüthing, Bernhard Steffen · 1994
A new aggressive algorithm for the elimination of partially dead code is presented, i.e., of code which is only dead on some program paths. Besides being more powerful than the usual approaches to dead code elimination, this algorithm is optimal in the following sense: partially dead code remaining in the resulting program cannot be eliminated without changing the branching structure or the semantics of the program, or without impairing some program executions.
Cited by 189
2008
A new aggressive algorithm for the elimination of par-tially dead code is presented, i.e., of code which is only dead on some program paths. Besides being more pow-erful than the usual approaches to dead code elimina-tion, this algorithm is optimal in the following sense: partially dead code remaining in the resulting program cannot be eliminated without changing the branching structure or the semantics of the programt or without impairing some program executions. Our approach is based on techniques for partial re-dundancy elimination. Besides some new technical problems there is a significant difference here: partial dead code elimination introduces second order effects, which we overcome by means of exhaustive motion and elimination steps. The optimality and the uniqueness of the program obtained is proved by means of a new technique which is universally applicable and partic-ularly useful in the case of mutually interdependent program optimizationso Topics: data flow analysis, program optimization, dead code elimination, partial redundancy elimination, code motion, assignment motion, bit-vector data flow analyses. 1
Cited by 0
Girsberger, Yann W. · Repository for Publications and Research Data (ETH Zurich) · 2022
Cited by 0Open access
Jingling Xue, Qiong Cai, Lin Gao · Software Practice and Experience · 2006
This paper presents the design, implementation and experimental evaluation of a practical region-based partial dead code elimination (PDE) algorithm on predicated code in the Open Research Compiler framework. Existing PDE algorithms are not applicable on predicated code due to the existence of if-converted branches in the program. The proposed algorithm processes all PDE candidates in a worklist and considers their partial deadness using predicate partition graphs. Our algorithm operates uniformly on individual hyperblocks as well as regions comprising of basic blocks and hyperblocks. The result of applying our algorithm to a single-entry multiple-exit (SEME) region is optimal: partially dead code cannot be removed without changing the branching structure of the program or potentially introducing new predicate defining instructions. We present statistical evidence about the PDE opportunities in the 17 SPEC95 and SPEC00 integer benchmarks. Our algorithm achieves performance improvements in 12 out of the 17 benchmarks on an Itanium machine at small compilation overheads. Our results indicate that our algorithm can be used as a practical pass before instruction scheduling. Copyright © 2006 John Wiley & Sons, Ltd.
Cited by 2
Rastislav Bodík, Rajiv Gupta · 1997
We present an approach for optimizing programs that uncovers additional opportunities for optimization of a statement by predicating the statement. In this paper predication algorithms for achieving partial dead code elimination (PDE) are presented. The process of predication embeds a statement in a control flow structure such that the statement is executed only if the execution follows a path along which the value computed by the statement is live. The control flow restructuring performed to achieve predication is expressed through slicing transformations. This approach achieves PDE that is not realizable by existing algorithms. We prove that our algorithm never increases the operation count along any path, and that for acyclic code all partially dead statements are eliminated. The slicing transformation that achieves predication introduces into the program additional conditional branches. These branches are eliminated in a branch deletion step based upon code duplication. We also show how PDE can be used by acyclic schedulers for VLIW processors to reduce critical path lengths along frequently executed paths.
Cited by 57Open access
Rastislav Bod'ik, Rajiv Gupta · 1997
We present an approach for optimizing programs that uncovers additional opportunities for optimization of a statement by predicating the statement. In this paper predication algorithms for achieving partial dead code elimination (PDE) are presented. The process of predication embeds a statement in a control flow structure such that the statement is executed only if the execution follows a path along which the value computed by the statement is live. The control flow restructuring performed to achieve predication is expressed through slicing transformations. This approach achieves PDE that is not realizable by existing algorithms. We prove that our algorithm never increases the operation count along any path, and that for acyclic code all partially dead statements are eliminated. The slicing transformation that achieves predication introduces into the program additional conditional branches. These branches are eliminated in a branch deletion step based upon code duplication. We also sho...
Cited by 0
Malavolta, Ivano, Nirghin, Kishan, Scoccia, Gian Luca et al. · arXiv (Cornell University) · 2023
Web apps are built by using a combination of HTML, CSS, and JavaScript. While building modern web apps, it is common practice to make use of third-party libraries and frameworks, as to improve developers' productivity and code quality. Alongside these benefits, the adoption of such libraries results in the introduction of JavaScript dead code, i.e., code implementing unused functionalities. The costs for downloading and parsing dead code can negatively contribute to the loading time and resource usage of web apps. The goal of our study is two-fold. First, we present Lacuna, an approach for automatically detecting and eliminating JavaScript dead code from web apps. The proposed approach supports both static and dynamic analyses, it is extensible and can be applied to any JavaScript code base, without imposing constraints on the coding style or on the use of specific JavaScript constructs. Secondly, by leveraging Lacuna we conduct an experiment to empirically evaluate the run-time overhead of JavaScript dead code in terms of energy consumption, performance, network usage, and resource usage in the context of mobile web apps. We applied Lacuna four times on 30 mobile web apps independently developed by third-party developers, each time eliminating dead code according to a different optimization level provided by Lacuna. Afterward, each different version of the web app is executed on an Android device, while collecting measures to assess the potential run-time overhead caused by dead code. Experimental results, among others, highlight that the removal of JavaScript dead code has a positive impact on the loading time of mobile web apps, while significantly reducing the number of bytes transferred over the network.
Cited by 0Open access
Jan Olaf, Blech Lars, Gesellensetter Sabine Glesner · 2008
Correct compilers are a vital precondition to ensure software correctness. Optimizations are the most error-prone phases in compilers. In this paper, we formally verify dead code elimination (DCE) within the theorem prover Isabelle/HOL. DCE is a popular optimization in compilers which is typically performed on the intermediate representation. In our work, we reformulate the algorithm for DCE so that it is applicable to static single assignment (SSA) form which is a state of the art intermediate representation in modern compilers, thereby showing that DCE is significantly simpler on SSA form than on classical intermediate representations. Moreover, we formally prove our algorithm correct within the theorem prover Isabelle/HOL. Our program equivalence criterion used in this proof is based on bisimulation and, hence, captures also the case of nontermination adequately. Finally we report on our implementation of this verified DCE algorithm in the industrialstrength Scale compiler system. 1.
Cited by 0
Jan Olaf Blech, Lars Gesellensetter, Sabine Glesner · 2005
Correct compilers are a vital precondition to ensure software correctness. Optimizations are the most error-prone phases in compilers. In this paper, we formally verify dead code elimination (DCE) within the theorem prover Isabelle/HOL. DCE is a popular optimization in compilers which is typically performed on the intermediate representation. In our work, we reformulate the algorithm for DCE so that it is applicable to static single assignment (SSA) form which is a state of the art intermediate representation in modern compilers, thereby showing that DCE is significantly simpler on SSA form than on classical intermediate representations. Moreover, we formally prove our algorithm correct within the theorem prover Isabelle/HOL. Our program equivalence criterion used in this proof is based on bisimulation and, hence, captures also the case of non-termination adequately. Finally we report on our implementation of this verified DCE algorithm in the industrial-strength scale compiler system.
Cited by 19
Association for Computational Linguistics 2025, Chen, Minyu, Li, Guoqiang et al. · Underline Science Inc. · 2025
Dead code introduces several challenges in software development, such as increased binary size and maintenance difficulties. It can also obscure logical errors and be exploited for obfuscation in malware. For LLM-based code-related tasks, dead code introduces vulnerabilities that can mislead these models, raising security concerns. Although modern compilers and IDEs offer dead code elimination, sophisticated patterns can bypass these tools. A universal approach that includes classification, location, explanation, and correction is needed, yet current tools often require significant manual effort. We present DCE-LLM, a framework for automated dead code elimination using a small CodeBERT model with an attribution-based line selector to efficiently locate suspect code. LLMs then generate judgments and explanations, fine-tuned on a large-scale, annotated dead code dataset to provide detailed explanations and patches. DCE-LLM outperforms existing tools, with advanced unreachability detection, automated correction, and support for multiple programming languages. Experimental results show DCE-LLM achieves over 94% F1 scores for unused and unreachable code, significantly surpassing GPT-4o by 30%.
Cited by 0Open access
Mohamed A. El-Zawawy · arXiv (Cornell University) · 2012
This paper presents a new approach for optimizing multitheaded programs with pointer constructs. The approach has applications in the area of certified code (proof-carrying code) where a justification or a proof for the correctness of each optimization is required. The optimization meant here is that of dead code elimination. Towards optimizing multithreaded programs the paper presents a new operational semantics for parallel constructs like join-fork constructs, parallel loops, and conditionally spawned threads. The paper also presents a novel type system for flow-sensitive pointer analysis of multithreaded programs. This type system is extended to obtain a new type system for live-variables analysis of multithreaded programs. The live-variables type system is extended to build the third novel type system, proposed in this paper, which carries the optimization of dead code elimination. The justification mentioned above takes the form of type derivation in our approach.
Cited by 0Open access
Theodoros Theodoridis, Manuel Rigger, Zhendong Su · 2022
Compilers are foundational software development tools and incorporate increasingly sophisticated optimizations. Due to their complexity, it is difficult to systematically identify opportunities for improving them. Indeed, the automatic discovery of missed optimizations has been an important and significant challenge. The few existing approaches either cannot accurately pinpoint missed optimizations or target only specific analyses. This paper tackles this challenge by introducing a novel, effective approach that --- in a simple and general manner --- automatically identifies a wide range of missed optimizations. Our core insight is to leverage dead code elimination (DCE) to both analyze how well compilers optimize code and identify missed optimizations: (1) insert "optimization markers" in the basic blocks of a given program, (2) compute the program's live/dead basic blocks using the "optimization markers", and (3) identify missed optimizations from how well compilers eliminate dead blocks. We essentially exploit that, since DCE heavily depends on the rest of the optimization pipeline, through the lens of DCE, one can systematically quantify how well compilers optimize code. We conduct an extensive analysis of GCC and LLVM using our approach, which (1) provides quantitative and qualitative insights regarding their optimization capabilities, and (2) uncovers a diverse set of missed optimizations. Our results also lead to 84 bug reports for GCC and LLVM, of which 62 have already been confirmed or fixed, demonstrating our work's strong practical utility. We expect that the simplicity and generality of our approach will make it widely applicable for understanding compiler performance and finding missed optimizations. This work opens and initiates this promising direction.
Cited by 41
Hidde Boomsma · Research Repository (Delft University of Technology) · 2012
Dead code is source code that is not necessary for the correct execution of an application. Dead code is a result of software ageing. It is a threat for maintainability and should therefore be removed. Many organizations in the web domain have the problem that their software grows and demands increasingly more effort to maintain, test, check out and deploy. Old features often remain in the software, because their dependencies are not obvious from the software documentation. Dead code can be found by collecting the set of code that is used and subtract this set from the set of all code. Collecting the set can be done statically or dynamically. Web applications are often written in dynamic languages. For dynamic languages dynamic analysis suits best. From the maintainability perspective a dynamic analysis is preferred over static analysis because it is able to detect reachable but unused code. %Via dynamic analysis all unused files are visualized in a tree map in which you can click the boxes to open them like you open directories in an ordinary file explorer. Also an Eclipse plug-in is developed to reduce the impact of existing dead code to the development process before removing it. In this thesis, we develop and evaluate techniques and tools to support software engineering with dead code identification and elimination for dynamic languages. The language used for evaluation is PHP, one of the most commonly used languages in web development. We demonstrate how and to which extent the techniques and tools proposed can support software developers at Hostnet, a Dutch web hosting organization.
Cited by 0Open access
Vivek Kumar, Ankit Jangid, Yash Gehlot et al. · 2025
In the 21st-century web application world, dependency bloat has become an important issue in which giant JavaScript (JS) bundle frequently include large portions of dead code of third-party libraries. The bloat causes slowness of page loading, generates more energy and leaves a larger carbon footprint to web browsing. It is important to reduce the size of a JS bundle, which means eliminating dead codes (tree-shaking), but in this case, it means better performance and sustainability. New classes of these tools, such as Lacuna [1] and Muzeel [2] detect and remove unused JS code dynamically. In the current paper, the empirical testing is offered to show that eliminating the dead JS code plays a crucial role in decreasing the loading rates of the pages and bytes transferred. We describe the designations of the evaluation tools utilised such as Chrome Developer Tools, WebPageTest and Trepn Profiler within smart phones. What we have registered as an optimized bundle is a smaller sum by up to 60 percent, page load time is lowered by between 25-30 percent and ultimately, energy CO<inf xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">2</inf> emission per page is reduced. We can demonstrate this amelioration by giving bar, line and pie charts which indicate the average size reduction, improvement in loadtime and the amount of unused codes. Moreover, we mention trade-offs, including being operational, and implicit consequences of implementing green web development practices in practice.
Cited by 0
Marcelino Rodriguez-Cancio, Benoît Combemale, Benoit Baudry · HAL (Le Centre pour la Communication Scientifique Directe) · 2016
International audience
Cited by 0Open access
Niels Groot Obbink, Ivano Malavolta, Gian Luca Scoccia et al. · VU Research Portal · 2018
JavaScript is becoming the de-facto programming language of the Web. Large-scale web applications (web apps) written in Javascript are commonplace nowadays, with big technology players (e.g., Google, Facebook) using it in their core flagship products. Today, it is common practice to reuse existing JavaScript code, usually in the form of third-party libraries and frameworks. If on one side this practice helps in speeding up development time, on the other side it comes with the risk of bringing dead code, i.e., JavaScript code which is never executed, but still downloaded from the network and parsed in the browser. This overhead can negatively impact the overall performance and energy consumption of the web app. In this paper we present Lacuna, an approach for JavaScript dead code elimination, where existing JavaScript analysis techniques are applied in combination. The proposed approach supports both static and dynamic analyses, it is extensible, and independent of the specificities of the used JavaScript analysis techniques. Lacuna can be applied to any JavaScript code base, without imposing any constraints to the developer, e.g., on her coding style or on the use of some specific JavaScript feature (e.g., modules). Lacuna has been evaluated on a suite of 29 publicly-available web apps, composed of 15,946 JavaScript functions, and built with different JavaScript frameworks (e.g., Angular, Vue.js, jQuery). Despite being a prototype, Lacuna obtained promising results in terms of analysis execution time and precision.
Cited by 28Open access
Theodoridis Theodoros, Rigger Manuel, Zhendong, Su · Zenodo (CERN European Organization for Nuclear Research) · 2021
Ths artifact consists of a docker image with instructions, the dataset, and the code necessary to reproduce the evaluation of <em>Finding Missed Optimizations through the Lens of Dead Code Elimination ASPLOS 22.</em>
Cited by 0Open access
Corinne Ancourt, Corinne Ancourt, Fabien Coelho et al. · 1996
pips is an experimental tool to implement and evaluate various interprocedural compilation, parallelization, analysis and optimization techniques. This paper focuses on the workbench used to build these compilers and how to add a new phase in pips, a dead code elimination, using the management of data structures, of dependences between the various analysis and transformation phases, and using the mathematical libraries in pips. pips is available to the community and it is what motivates this article. Keywords: programming environment, workbench, make, interprocedural parallelizer, interactive parallelizer, optimizer, dead code elimination, reverse engineering, case. 1 Introduction Together with the computer architectural evolution, three main directions in compiler developments have been pursued: compilers for sequential machines (with superscalar processors), parallelizers of sequential programs and compilers for explicit parallel programs. All these approaches benefit from deep glo...
Cited by 0