Skip to content

Commit 391f9ef

Browse files
committed
[docs] Fix load instructions in chapter 7 of the tutorial
Loads in the first half of the chapter are missing the type argument. Patched By: klao (Mihaly Barasz) Reviewed By: Jim Differential Revision: https://reviews.llvm.org/D90326
1 parent 82f8aef commit 391f9ef

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ two values. The LLVM IR that we want for this example looks like this:
6363
br i1 %Condition, label %cond_true, label %cond_false
6464
6565
cond_true:
66-
%X.0 = load i32* @G
66+
%X.0 = load i32, i32* @G
6767
br label %cond_next
6868
6969
cond_false:
70-
%X.1 = load i32* @H
70+
%X.1 = load i32, i32* @H
7171
br label %cond_next
7272
7373
cond_next:
@@ -126,7 +126,7 @@ instruction <../../LangRef.html#alloca-instruction>`_:
126126
entry:
127127
%X = alloca i32 ; type of %X is i32*.
128128
...
129-
%tmp = load i32* %X ; load the stack value %X from the stack.
129+
%tmp = load i32, i32* %X ; load the stack value %X from the stack.
130130
%tmp2 = add i32 %tmp, 1 ; increment it
131131
store i32 %tmp2, i32* %X ; store it back
132132
...
@@ -149,17 +149,17 @@ using a PHI node:
149149
br i1 %Condition, label %cond_true, label %cond_false
150150
151151
cond_true:
152-
%X.0 = load i32* @G
152+
%X.0 = load i32, i32* @G
153153
store i32 %X.0, i32* %X ; Update X
154154
br label %cond_next
155155
156156
cond_false:
157-
%X.1 = load i32* @H
157+
%X.1 = load i32, i32* @H
158158
store i32 %X.1, i32* %X ; Update X
159159
br label %cond_next
160160
161161
cond_next:
162-
%X.2 = load i32* %X ; Read X
162+
%X.2 = load i32, i32* %X ; Read X
163163
ret i32 %X.2
164164
}
165165
@@ -191,11 +191,11 @@ example through the pass, for example, you'll get:
191191
br i1 %Condition, label %cond_true, label %cond_false
192192
193193
cond_true:
194-
%X.0 = load i32* @G
194+
%X.0 = load i32, i32* @G
195195
br label %cond_next
196196
197197
cond_false:
198-
%X.1 = load i32* @H
198+
%X.1 = load i32, i32* @H
199199
br label %cond_next
200200
201201
cond_next:

0 commit comments

Comments
 (0)