Skip to content

Commit 02e2d22

Browse files
committed
[DOC] Fix load instructions' syntax, function definition.
Summary: In this patch, I updated `load` instruction syntax and fixed function definition. Besides, I re-named some variables to make them obey SSA rule. Reviewers: MaskRay Reviewed By: MaskRay Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63186 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363142 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 0276d51 commit 02e2d22

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/GetElementPtr.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ therefore be indexed and requires an index operand. Consider this example:
7474
P[0].f1 = P[1].f1 + P[2].f2;
7575
}
7676
...
77-
munger_struct Array[3];
77+
struct munger_struct Array[3];
7878
...
7979
munge(Array);
8080
@@ -88,15 +88,15 @@ looks like:
8888

8989
.. code-block:: llvm
9090
91-
void %munge(%struct.munger_struct* %P) {
91+
define void @munge(%struct.munger_struct* %P) {
9292
entry:
9393
%tmp = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 1, i32 0
94-
%tmp = load i32* %tmp
95-
%tmp6 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 2, i32 1
96-
%tmp7 = load i32* %tmp6
97-
%tmp8 = add i32 %tmp7, %tmp
98-
%tmp9 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 0, i32 0
99-
store i32 %tmp8, i32* %tmp9
94+
%tmp1 = load i32, i32* %tmp
95+
%tmp2 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 2, i32 1
96+
%tmp3 = load i32, i32* %tmp2
97+
%tmp4 = add i32 %tmp3, %tmp1
98+
%tmp5 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 0, i32 0
99+
store i32 %tmp4, i32* %tmp5
100100
ret void
101101
}
102102
@@ -199,7 +199,7 @@ following:
199199
.. code-block:: text
200200
201201
%idx = getelementptr { [40 x i32]* }, { [40 x i32]* }* %, i64 0, i32 0
202-
%arr = load [40 x i32]** %idx
202+
%arr = load [40 x i32]*, [40 x i32]** %idx
203203
%idx = getelementptr [40 x i32], [40 x i32]* %arr, i64 0, i64 17
204204
205205
In this case, we have to load the pointer in the structure with a load

0 commit comments

Comments
 (0)