Re: [LAD] gcc and pointer aliasing... missing optimizations in some cases

From: Gabriel M. Beddingfield <gabriel@email-addr-hidden>
Date: Tue Dec 22 2009 - 21:21:26 EET

On Tue, 22 Dec 2009, torbenh wrote:

> class Ramp
> {
> private:
> float _phase;
> float _omega;
> public:
> Ramp();
> float process()
> {
> _phase += _omega;
> return _phase;
> }
> };

Is the problem that _phase and _omega get reloaded from
memory every time they're used?

Would it not work to declare process() as:

     float process() __restrict
     { ... }

Thus telling the compiler that `this` is not an alias when
process() is called.

Or perhaps:

> int process( jack_nframes_t nframes, void *arg )
> {
> int i;
>
> float * __restrict__ buf = (float *) jack_port_get_buffer( out_port, nframes );

      Ramp * __restrict__ o = &osc_block;

>
> for( i=0; i<nframes; i++ ) {
> buf[i] = osc_block.process();

Change to:
         buf[i] = o->process();

-gabriel

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Wed Dec 23 00:15:04 2009

This archive was generated by hypermail 2.1.8 : Wed Dec 23 2009 - 00:15:04 EET