Lifetime-optimal speculative partial redundancy elimination (lospre) is the most advanced currently known redundancy elimination technique. It subsumes many previously known approaches, such as common subexpression elimination, global common subexpression elimination, and loop-invariant code motion. However, previously known lospre algorithms have high time complexity; faster but less powerful approaches have been used and developed further instead. We present a simple linear-time algorithm for lospre for structured programs that can also handle some more general scenarios compared to previous approaches. We prove that our approach is optimal and that the runtime is linear in the number of nodes in the control-flow graph. The condition on programs of being structured is automatically true for many programming languages and for others, such as C, is equivalent to a bound on the number of goto labels per function. An implementation in a mainstream C compiler demonstrates the practical feasibility of our approach. Our approach is based on graph-structure theory and uses tree-decompositions. We also show that, for structured programs, the runtime of deterministic implementations of the previously known MC-PRE and MC-SSAPRE algorithms can be bounded by $O(n^{2.5})$, improving the previous bounds of $O(n^3)$.
翻译:寿命最理想的投机性部分裁员消除(lospre)是目前最先进的已知裁员消除技术(lospre),它包含许多以前已知的方法,例如共同的子表达式消除、全球共同的子表达式消除和环形异变代码运动。然而,先前已知的Lospre算法具有很高的时间复杂性;使用和进一步发展了较快但较弱的方法。我们为结构化程序提出了一个简单的线性时间算法,与以前的方法相比,这些系统化程序也可以处理一些较一般的情景。我们证明,我们的方法是最佳的,运行时间是控制流程图中节点数中的线性时间。构建程序的条件对许多程序语言和诸如C等其它程序自动是真实的,相当于对每个功能的goto标签数的约束。在主流的C编译器中实施的方法显示了我们的方法的实际可行性。我们的方法基于图表结构学理论,并使用树分解。我们还表明,对于结构化程序而言,对先前已知的MC-PRE美元和US-SARC3号的固定性执行时间可以由以前已知的MA-SAS-SAS-RO3美元捆绑起来。