Skip to content

Commit c21f11a

Browse files
authored
Restore nameless IRBuilder insert method. (#483)
1 parent f3a2836 commit c21f11a

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "LLVM"
22
uuid = "929cbde3-209d-540e-8aea-75f648917ca0"
3-
version = "9.1.1"
3+
version = "9.1.2"
44

55
[deps]
66
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"

src/irbuilder.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ position!(builder::IRBuilder) = API.LLVMClearInsertionPosition(builder)
8787
Insert an instruction into the current basic block at the current position, optionally
8888
giving it a name.
8989
"""
90-
Base.insert!(builder::IRBuilder, inst::Instruction, name::String) =
90+
Base.insert!(builder::IRBuilder, inst::Instruction, name::String="") =
9191
API.LLVMInsertIntoBuilderWithName(builder, inst, name)
9292

9393
"""

test/instructions_tests.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,11 +558,14 @@ end
558558
entry = BasicBlock(fun, "entry")
559559
position!(builder, entry)
560560
# add and substract 42
561+
561562
a = fadd!(builder, parameters(fun)[1], LLVM.ConstantFP(Float32(42.)), "a")
562-
# fast_math!(a; all=true)
563563
b = fsub!(builder, a, LLVM.ConstantFP(Float32(42.)), "b")
564-
# fast_math!(b; all=true)
565-
ret!(builder, b)
564+
retinst = ret!(builder, b)
565+
566+
# support for removing/insertion
567+
remove!(retinst)
568+
insert!(builder, retinst)
566569
end
567570
verify(mod)
568571

0 commit comments

Comments
 (0)