reactorlabs/rir

sequences starting with non-constant value

Offen

#789 geöffnet am 22.01.2020

 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C++ (19 Forks)github user discovery
enhancementgood first issuehelp wantedpir

Repository-Metriken

Stars
 (61 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 1m) (1 gemergte PR in 30 T)

Beschreibung

For some reason in https://github.com/reactorlabs/rir/blob/master/rir/src/ir/Compiler.cpp#L238 we only properly compile a simple for loop for (i in a:b) if a is a numerical constant.

This causes us to allocate lots of unnecessary vectors (e.g. in nbody_naive_2).

I suspect that this is a hack, exploiting the fact that a < b happens to error similarly to a:b if a is a number.

This should be fixable quite easily by emitting a check for the type of a ensuring that it is compatible with : first.

Contributor Guide