Commit 05ebb38
Remove frule for getindex(::Tuple, i) (#680)
* Remove frule for getindex(::Tuple, i)
Having this chain rule is sub-optimal, because it prevents early-SROA
in Diffractor-like systems that would like to perform some optimizations
before applying AD (but can't do any optimization on functions that
have custom rules). By letting it go down to the `getfield`, regular
SROA can apply. Any AD system should handle `getfield` anyway, so
I don't think there's a strong reason to have this.
Similar reasoning applies to the reverse rules also, but they
aren't currently actively causing me problems, so this PR only
removes the frule, since I don't think many other packages are
using them. We can revisit the rrules later.
* Also remove the rules for first/tail
For similar reasons as getindex, having a rule for first/tail is
suboptimal because it supresses early SROA. Tail is particularly
problematic, because it is used in the implementation of the
```
x, y... = abc
```
syntax, of which users expect early elimination.
* add getfield rule and remove tests for deleted rules
---------
Co-authored-by: Oscar Smith <oscardssmith@gmail.com>1 parent 859f6ab commit 05ebb38
2 files changed
+6
-57
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
12 | 4 | | |
13 | 5 | | |
14 | 6 | | |
| |||
77 | 69 | | |
78 | 70 | | |
79 | 71 | | |
80 | | - | |
| 72 | + | |
81 | 73 | | |
82 | 74 | | |
83 | 75 | | |
| |||
191 | 183 | | |
192 | 184 | | |
193 | 185 | | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | 186 | | |
218 | 187 | | |
219 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 6 | + | |
12 | 7 | | |
13 | 8 | | |
14 | 9 | | |
| |||
168 | 163 | | |
169 | 164 | | |
170 | 165 | | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
| 166 | + | |
187 | 167 | | |
188 | 168 | | |
189 | 169 | | |
| |||
0 commit comments