From 0433965b5b919d48e0bc0b3ea3080ab6c8f832ca Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Tue, 16 Sep 2025 09:17:52 -0700 Subject: [PATCH] [llvm] Proofread Passes.rst --- llvm/docs/Passes.rst | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/llvm/docs/Passes.rst b/llvm/docs/Passes.rst index e297d3883c39e..8cbe4eeb8a869 100644 --- a/llvm/docs/Passes.rst +++ b/llvm/docs/Passes.rst @@ -16,15 +16,15 @@ Introduction is most likely incomplete. It is possible to list passes known by the opt tool using ``opt -print-passes``. -This document serves as a high level summary of the optimization features that +This document serves as a high-level summary of the optimization features that LLVM provides. Optimizations are implemented as Passes that traverse some portion of a program to either collect information or transform the program. The table below divides the passes that LLVM provides into three categories. Analysis passes compute information that other passes can use or for debugging or program visualization purposes. Transform passes can use (or invalidate) the analysis passes. Transform passes all mutate the program in some way. -Utility passes provides some utility but don't otherwise fit categorization. -For example passes to extract functions to bitcode or write a module to bitcode +Utility passes provide some utility but don't otherwise fit categorization. +For example, passes to extract functions to bitcode or write a module to bitcode are neither analysis nor transform passes. The table of contents above provides a quick summary of each pass and links to the more complete pass description later in the document. @@ -61,7 +61,7 @@ Yet to be written. ``da``: Dependence Analysis --------------------------- -Dependence analysis framework, which is used to detect dependences in memory +Dependence analysis framework, which is used to detect dependencies in memory accesses. ``domfrontier``: Dominance Frontier Construction @@ -90,7 +90,7 @@ postscript or some other suitable format. This pass, only available in ``opt``, prints the control flow graph into a ``.dot`` graph. This graph can then be processed with the :program:`dot` tool to convert it to postscript or some other suitable format. -Additionally the ``-cfg-func-name=`` option can be used to filter the +Additionally, the ``-cfg-func-name=`` option can be used to filter the functions that are printed. All functions that contain the specified substring will be printed. @@ -101,7 +101,7 @@ This pass, only available in ``opt``, prints the control flow graph into a ``.dot`` graph, omitting the function bodies. This graph can then be processed with the :program:`dot` tool to convert it to postscript or some other suitable format. -Additionally the ``-cfg-func-name=`` option can be used to filter the +Additionally, the ``-cfg-func-name=`` option can be used to filter the functions that are printed. All functions that contain the specified substring will be printed. @@ -240,7 +240,7 @@ standard error in a human-readable form. --------------------------------------------------- This pass, only available in ``opt``, prints the SCCs of each function CFG to -standard error in a human-readable fom. +standard error in a human-readable form. ``function(print)``: Print function to stderr --------------------------------------------- @@ -486,7 +486,7 @@ Bottom-up inlining of functions into callees. ``instcombine``: Combine redundant instructions ----------------------------------------------- -Combine instructions to form fewer, simple instructions. This pass does not +Combine instructions to form fewer, simpler instructions. This pass does not modify the CFG. This pass is where algebraic simplification happens. This pass combines things like: @@ -502,7 +502,7 @@ into: %Z = add i32 %X, 2 -This is a simple worklist driven algorithm. +This is a simple worklist-driven algorithm. This pass guarantees that the following canonicalizations are performed on the program: @@ -532,9 +532,9 @@ library calls on different targets. ``aggressive-instcombine``: Combine expression patterns -------------------------------------------------------- -Combine expression patterns to form expressions with fewer, simple instructions. +Combine expression patterns to form expressions with fewer, simpler instructions. -For example, this pass reduce width of expressions post-dominated by TruncInst +For example, this pass reduces the width of expressions post-dominated by ``TruncInst`` into smaller width when applicable. It differs from instcombine pass in that it can modify CFG and contains pattern @@ -722,7 +722,7 @@ determine the trip counts of loops easily. --------------------------------------------- This pass implements a simple unroll and jam classical loop optimisation pass. -It transforms loop from: +It transforms a loop from: .. code-block:: c++ @@ -799,11 +799,11 @@ This pass looks for equivalent functions that are mergeable and folds them. Total-ordering is introduced among the functions set: we define comparison that answers for every two functions which of them is greater. It allows to -arrange functions into the binary tree. +arrange functions into a binary tree. -For every new function we check for equivalent in tree. +For every new function we check for equivalent in the tree. -If equivalent exists we fold such functions. If both functions are overridable, +If equivalent exists, we fold such functions. If both functions are overridable, we move the functionality into a new internal function and leave two overridable thunks to it. @@ -838,7 +838,7 @@ For example: 4 + (x + 5) ⇒ x + (4 + 5) In the implementation of this algorithm, constants are assigned rank = 0, function arguments are rank = 1, and other values are assigned ranks -corresponding to the reverse post order traversal of current function (starting +corresponding to the reverse post-order traversal of the current function (starting at 2), which effectively gives values in deep loops higher rank than values not in loops. @@ -1019,7 +1019,7 @@ noisy. ``verify``: Module Verifier --------------------------- -Verifies an LLVM IR code. This is useful to run after an optimization which is +Verifies LLVM IR code. This is useful to run after an optimization which is undergoing testing. Note that llvm-as verifies its input before emitting bitcode, and also that malformed bitcode is likely to make LLVM crash. All language front-ends are therefore encouraged to verify their output before @@ -1059,7 +1059,7 @@ instead just tries to ensure that code is well-formed. ---------------------------------- Displays the control flow graph using the GraphViz tool. -Additionally the ``-cfg-func-name=`` option can be used to filter the +Additionally, the ``-cfg-func-name=`` option can be used to filter the functions that are displayed. All functions that contain the specified substring will be displayed. @@ -1068,7 +1068,7 @@ will be displayed. Displays the control flow graph using the GraphViz tool, but omitting function bodies. -Additionally the ``-cfg-func-name=`` option can be used to filter the +Additionally, the ``-cfg-func-name=`` option can be used to filter the functions that are displayed. All functions that contain the specified substring will be displayed.