Value Propagation pass and memory use

Hi all,
for various reasons, I am limiting clang during builds in pkgsrc to 2GB
address space. Given that e.g. ARM boards typically have only 1 or 2GB,
that's a very practical limit. There are a number of builds that fail
because clang hits that limit and for the majority, they all fail in the
Value Propagation pass. I'd like to have an option for more selectively
dealing with this -- -O0 is a very blunt hammer.

(a) Is it possible to restrict the memory use and the associated CPU
time use at least for -O2? The problematic cases also tend to be very
slow, 5min+ builds are seen on a E3 Xeon.

(b) Add an internal flag and go with -mllvm -disable-value-propagation.
This is a relatively small patch, but I dislike the dependency on the
implementation details.

(c) Add a proper flag for clang and associated PM option.

Joerg

Is there an inherent reason Value Propagation is so memory hungry? It might be an independently useful improvement to improve the memory usage of Value Propagation so that it isn’t the high water mark.

– Sean Silva