Skip to content

Commit b1feba8

Browse files
committed
mf
1 parent 5e8074c commit b1feba8

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/llvm/transforms.jl

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2573,7 +2573,26 @@ function removeDeadArgs!(mod::LLVM.Module, tm::LLVM.TargetMachine, post_gc_fixup
25732573
for u in LLVM.uses(fn)
25742574
u = LLVM.user(u)
25752575
if isa(u, LLVM.ConstantExpr)
2576-
u = LLVM.user(only(LLVM.uses(u)))
2576+
for u in LLVM.uses(u)
2577+
u = LLVM.user(u)
2578+
if !isa(u, LLVM.CallInst)
2579+
continue
2580+
end
2581+
@assert isa(u, LLVM.CallInst)
2582+
B = IRBuilder()
2583+
nextInst = LLVM.Instruction(LLVM.API.LLVMGetNextInstruction(u))
2584+
position!(B, nextInst)
2585+
inp = operands(u)[idx]
2586+
cl = call!(B, funcT, sfunc, LLVM.Value[inp])
2587+
if isa(value_type(inp), LLVM.PointerType)
2588+
LLVM.API.LLVMAddCallSiteAttribute(
2589+
cl,
2590+
LLVM.API.LLVMAttributeIndex(1),
2591+
EnumAttribute("nocapture"),
2592+
)
2593+
end
2594+
end
2595+
continue
25772596
end
25782597
if !isa(u, LLVM.CallInst)
25792598
continue

0 commit comments

Comments
 (0)