Open Quuxplusone opened 7 years ago
Please provide a bitcode file to reproduce this.
Attached p0.bc
(1988 bytes, application/octet-stream): Bitcode file to reproduce the problem.
When a pass removes more datastructures (instructions, metadata, ...) than it creates I can see this happening. The number is the difference of memory used before and after running a pass.
(In reply to Matthias Braun from comment #3)
> When a pass removes more datastructures (instructions, metadata, ...) than
> it creates I can see this happening. The number is the difference of memory
> used before and after running a pass.
Yes, that's what happening (just debugged).
I think it's a little weird but presumably we should live with it?
The alternative would be that of just report zero in ca se the number is
negative? (I guess that may be less confusing, but also less useful).
I'd leave the behavior as is.
(If anything I would remove the whole option, and recomment people to rather use something like valgrind/massif, instruments etc. to capture actual peak memory usage. I don't see the use in before/after pass comparisons, esp. with analysis passes sometimes staying alive for a longer timer).
(In reply to Matthias Braun from comment #5)
> I'd leave the behavior as is.
>
> (If anything I would remove the whole option, and recomment people to rather
> use something like valgrind/massif, instruments etc. to capture actual peak
> memory usage. I don't see the use in before/after pass comparisons, esp.
> with analysis passes sometimes staying alive for a longer timer).
Yes, I tend to agree.
FWIW, the same issue happens with `-time-passes`, LVI returns pretty much no
time but Jump Threading and VRP account for all the time spent in it, so the
numbers are already somehow wrong.
I'd claim that with the approximate measurements time-passes is still useful no
matter what although, as you say, it's hard to imagine why you don't want to
use valgrind (or something similar) for memory measurements.
(In reply to Matthias Braun from comment #3)
> When a pass removes more datastructures (instructions, metadata, ...) than
> it creates I can see this happening. The number is the difference of memory
> used before and after running a pass.
Then, I'd say that keeping the negative numbers is actually a good thing
because it helps in understanding pass behaviour. If the documentation:
-track-memory - Enable -time-
passes memory tracking (this may be slow)
is updated to reflect the same; it would not be confusing anymore.
p0.bc
(1988 bytes, application/octet-stream)