Skip to content

Commit bec80b6

Browse files
committed
wrap IsATerminatorInst.
1 parent e88958a commit bec80b6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/core/instructions.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ called_value(inst::Instruction) = Value(API.LLVMGetCalledValue(ref(inst)))
142142

143143
## terminators
144144

145-
export isconditional, condition, condition!, default_dest
145+
export isterminator, isconditional, condition, condition!, default_dest
146+
147+
isterminator(inst::Instruction) = LLVM.API.LLVMIsATerminatorInst(LLVM.ref(inst)) != C_NULL
146148

147149
isconditional(br::Instruction) = convert(Core.Bool, API.LLVMIsConditional(ref(br)))
148150

test/core.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ LLVM.Module("SomeModule", ctx) do mod
235235

236236
valueinst1 = add!(builder, parameters(fn)[1],
237237
ConstantInt(Int32(1), ctx))
238+
@test !isterminator(valueinst1)
238239

239240
userinst = add!(builder, valueinst1,
240241
ConstantInt(Int32(1), ctx))
@@ -868,6 +869,7 @@ LLVM.Module("SomeModule", ctx) do mod
868869

869870
# terminators
870871

872+
@test isterminator(brinst)
871873
@test isconditional(brinst)
872874
@test condition(brinst) == parameters(fn)[1]
873875
condition!(brinst, parameters(fn)[2])

0 commit comments

Comments
 (0)