Skip to content

Commit 724e6e4

Browse files
authored
Fix symbol lookup consistency check (#2610)
1 parent f0c5735 commit 724e6e4

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/compiler/validation.jl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -142,21 +142,6 @@ import GPUCompiler: IRError, InvalidIRError
142142

143143
function restore_lookups(mod::LLVM.Module)::Nothing
144144
T_size_t = convert(LLVM.LLVMType, Int)
145-
for (v, k) in FFI.ptr_map
146-
if haskey(functions(mod), k)
147-
f = functions(mod)[k]
148-
replace_uses!(
149-
f,
150-
LLVM.Value(
151-
LLVM.API.LLVMConstIntToPtr(
152-
ConstantInt(T_size_t, convert(UInt, v)),
153-
value_type(f),
154-
),
155-
),
156-
)
157-
eraseInst(mod, f)
158-
end
159-
end
160145
for f in functions(mod)
161146
for fattr in collect(function_attributes(f))
162147
if isa(fattr, LLVM.StringAttribute)
@@ -175,6 +160,21 @@ function restore_lookups(mod::LLVM.Module)::Nothing
175160
end
176161
end
177162
end
163+
for (v, k) in FFI.ptr_map
164+
if haskey(functions(mod), k)
165+
f = functions(mod)[k]
166+
replace_uses!(
167+
f,
168+
LLVM.Value(
169+
LLVM.API.LLVMConstIntToPtr(
170+
ConstantInt(T_size_t, convert(UInt, v)),
171+
value_type(f),
172+
),
173+
),
174+
)
175+
eraseInst(mod, f)
176+
end
177+
end
178178
end
179179

180180
function check_ir(interp, @nospecialize(job::CompilerJob), mod::LLVM.Module)

0 commit comments

Comments
 (0)