FluxML / FluxML/IRTools.jl

Argument slots not preserved with slots = true?

Open
#31 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
113
Forks
37
PR merge metrics
No merged PRs in 30d

Description

As we see in the following example, the internal variable `y` is represented as a slot, but the argument `x` is just converted directly to `%2`:

```
julia> f3(x) = (y = x + 1; sin(2y))
f3 (generic function with 1 method)

julia> IRTools.IR(typeof(f3), Int; slots = true)
1: (%1, %2)
%3 = %2 + 1
%4 = @_3 = %3
%5 = 2 * @_3
%6 = Main.sin(%5)
return %6

julia> @code_lowered f3(1)
CodeInfo(
1 ─ y = x + 1
│ %2 = 2 * y
│ %3 = Main.sin(%2)
└── return %3
)
```

That appears to be done [on purpose](https://github.com/MikeInnes/IRTools.jl/blob/cfda7ffa9683e6ccf45589db83d160b35ffe8461/src/ir/wrap.jl#L171), but why? Is it just because I can "trivially" get the argument slot names from `meta.code`?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.