Skip to content

Commit f365194

Browse files
[llvm] Proofread AliasAnalysis.rst (#155553)
1 parent c307ada commit f365194

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

llvm/docs/AliasAnalysis.rst

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ query, respectively.
4545
The ``AliasAnalysis`` interface exposes information about memory, represented in
4646
several different ways. In particular, memory objects are represented as a
4747
starting address and size, and function calls are represented as the actual
48-
``call`` or ``invoke`` instructions that performs the call. The
48+
``call`` or ``invoke`` instructions that perform the call. The
4949
``AliasAnalysis`` interface also exposes some helper methods which allow you to
5050
get mod/ref information for arbitrary instructions.
5151

@@ -119,20 +119,20 @@ Must, May, and No Alias Responses
119119

120120
The ``NoAlias`` response may be used when there is never an immediate dependence
121121
between any memory reference *based* on one pointer and any memory reference
122-
*based* the other. The most obvious example is when the two pointers point to
122+
*based on* the other. The most obvious example is when the two pointers point to
123123
non-overlapping memory ranges. Another is when the two pointers are only ever
124124
used for reading memory. Another is when the memory is freed and reallocated
125125
between accesses through one pointer and accesses through the other --- in this
126126
case, there is a dependence, but it's mediated by the free and reallocation.
127127

128-
As an exception to this is with the :ref:`noalias <noalias>` keyword;
128+
An exception to this is with the :ref:`noalias <noalias>` keyword;
129129
the "irrelevant" dependencies are ignored.
130130

131131
The ``MayAlias`` response is used whenever the two pointers might refer to the
132132
same object.
133133

134134
The ``PartialAlias`` response is used when the two memory objects are known to
135-
be overlapping in some way, regardless whether they start at the same address
135+
be overlapping in some way, regardless of whether they start at the same address
136136
or not.
137137

138138
The ``MustAlias`` response may only be returned if the two memory objects are
@@ -205,15 +205,15 @@ satisfy the ``doesNotAccessMemory`` method also satisfy ``onlyReadsMemory``.
205205
Writing a new ``AliasAnalysis`` Implementation
206206
==============================================
207207

208-
Writing a new alias analysis implementation for LLVM is quite straight-forward.
208+
Writing a new alias analysis implementation for LLVM is quite straightforward.
209209
There are already several implementations that you can use for examples, and the
210-
following information should help fill in any details. For examples, take a
210+
following information should help fill in any details. For example, take a
211211
look at the `various alias analysis implementations`_ included with LLVM.
212212

213213
Different Pass styles
214214
---------------------
215215

216-
The first step to determining what type of :doc:`LLVM pass <WritingAnLLVMPass>`
216+
The first step is to determine what type of :doc:`LLVM pass <WritingAnLLVMPass>`
217217
you need to use for your Alias Analysis. As is the case with most other
218218
analyses and transformations, the answer should be fairly obvious from what type
219219
of problem you are trying to solve:
@@ -233,7 +233,7 @@ Your subclass of ``AliasAnalysis`` is required to invoke two methods on the
233233
``AliasAnalysis`` base class: ``getAnalysisUsage`` and
234234
``InitializeAliasAnalysis``. In particular, your implementation of
235235
``getAnalysisUsage`` should explicitly call into the
236-
``AliasAnalysis::getAnalysisUsage`` method in addition to doing any declaring
236+
``AliasAnalysis::getAnalysisUsage`` method in addition to declaring
237237
any pass dependencies your pass has. Thus you should have something like this:
238238

239239
.. code-block:: c++
@@ -243,7 +243,7 @@ any pass dependencies your pass has. Thus you should have something like this:
243243
// declare your dependencies here.
244244
}
245245

246-
Additionally, your must invoke the ``InitializeAliasAnalysis`` method from your
246+
Additionally, you must invoke the ``InitializeAliasAnalysis`` method from your
247247
analysis run method (``run`` for a ``Pass``, ``runOnFunction`` for a
248248
``FunctionPass``, or ``InitializePass`` for an ``ImmutablePass``). For example
249249
(as part of a ``Pass``):
@@ -344,7 +344,7 @@ The ``addEscapingUse`` method
344344
The ``addEscapingUse`` method is used when the uses of a pointer value have
345345
changed in ways that may invalidate precomputed analysis information.
346346
Implementations may either use this callback to provide conservative responses
347-
for points whose uses have change since analysis time, or may recompute some or
347+
for points whose uses have changed since analysis time, or may recompute some or
348348
all of their internal state to continue providing accurate responses.
349349

350350
In general, any new use of a pointer value is considered an escaping use, and
@@ -379,16 +379,16 @@ also no way of setting a chain of analyses as the default.
379379
There is no way for transform passes to declare that they preserve
380380
``AliasAnalysis`` implementations. The ``AliasAnalysis`` interface includes
381381
``deleteValue`` and ``copyValue`` methods which are intended to allow a pass to
382-
keep an AliasAnalysis consistent, however there's no way for a pass to declare
382+
keep an AliasAnalysis consistent; however, there's no way for a pass to declare
383383
in its ``getAnalysisUsage`` that it does so. Some passes attempt to use
384-
``AU.addPreserved<AliasAnalysis>``, however this doesn't actually have any
384+
``AU.addPreserved<AliasAnalysis>``; however, this doesn't actually have any
385385
effect.
386386

387387
Similarly, the ``opt -p`` option introduces ``ModulePass`` passes between each
388388
pass, which prevents the use of ``FunctionPass`` alias analysis passes.
389389

390390
The ``AliasAnalysis`` API does have functions for notifying implementations when
391-
values are deleted or copied, however these aren't sufficient. There are many
391+
values are deleted or copied; however, these aren't sufficient. There are many
392392
other ways that LLVM IR can be modified which could be relevant to
393393
``AliasAnalysis`` implementations which can not be expressed.
394394

@@ -406,7 +406,7 @@ unreliable.
406406
Many alias queries can be reformulated in terms of other alias queries. When
407407
multiple ``AliasAnalysis`` queries are chained together, it would make sense to
408408
start those queries from the beginning of the chain, with care taken to avoid
409-
infinite looping, however currently an implementation which wants to do this can
409+
infinite looping; however, currently an implementation which wants to do this can
410410
only start such queries from itself.
411411

412412
Using alias analysis results
@@ -477,7 +477,7 @@ will help make sense of why things are designed the way they are.
477477
Using the ``AliasAnalysis`` interface directly
478478
----------------------------------------------
479479

480-
If neither of these utility class are what your pass needs, you should use the
480+
If neither of these utility classes are what your pass needs, you should use the
481481
interfaces exposed by the ``AliasAnalysis`` class directly. Try to use the
482482
higher-level methods when possible (e.g., use mod/ref information instead of the
483483
`alias`_ method directly if possible) to get the best precision and efficiency.
@@ -488,7 +488,7 @@ Existing alias analysis implementations and clients
488488
If you're going to be working with the LLVM alias analysis infrastructure, you
489489
should know what clients and implementations of alias analysis are available.
490490
In particular, if you are implementing an alias analysis, you should be aware of
491-
the `the clients`_ that are useful for monitoring and evaluating different
491+
`the clients`_ that are useful for monitoring and evaluating different
492492
implementations.
493493

494494
.. _various alias analysis implementations:
@@ -513,7 +513,7 @@ important facts:
513513
* Many common standard C library functions `never access memory or only read
514514
memory`_.
515515
* Pointers that obviously point to constant globals "``pointToConstantMemory``".
516-
* Function calls can not modify or references stack allocations if they never
516+
* Function calls cannot modify or reference stack allocations if they never
517517
escape from the function that allocates them (a common case for automatic
518518
arrays).
519519

@@ -590,7 +590,7 @@ with any of the implementations above.
590590
The ``-adce`` pass
591591
^^^^^^^^^^^^^^^^^^
592592

593-
The ``-adce`` pass, which implements Aggressive Dead Code Elimination uses the
593+
The ``-adce`` pass, which implements Aggressive Dead Code Elimination, uses the
594594
``AliasAnalysis`` interface to delete calls to functions that do not have
595595
side-effects and are not used.
596596

@@ -602,7 +602,7 @@ transformations. It uses the ``AliasAnalysis`` interface for several different
602602
transformations:
603603

604604
* It uses mod/ref information to hoist or sink load instructions out of loops if
605-
there are no instructions in the loop that modifies the memory loaded.
605+
no instructions in the loop modify the memory loaded.
606606

607607
* It uses mod/ref information to hoist function calls out of loops that do not
608608
write to memory and are loop-invariant.
@@ -615,7 +615,7 @@ The ``-argpromotion`` pass
615615
^^^^^^^^^^^^^^^^^^^^^^^^^^
616616

617617
The ``-argpromotion`` pass promotes by-reference arguments to be passed in
618-
by-value instead. In particular, if pointer arguments are only loaded from it
618+
by-value instead. In particular, if pointer arguments are only loaded from, it
619619
passes in the value loaded instead of the address to the function. This pass
620620
uses alias information to make sure that the value loaded from the argument
621621
pointer is not modified between the entry of the function and any load of the

0 commit comments

Comments
 (0)