On 06/30/2010 03:06 PM, Jan Hubicka wrote:
If you can find actual simple examples where -Os is losing size and speed we 
can try
to do something about them.
According to our code size reports, inlining is completely screwed for C++ wrapper classes like ones often used for smart pointers, arrays, etc. See http://people.mozilla.com/~tglek/codesize45.txt

Would be really nice if this could be fixed in 4.5. It's tricky for us to switch to 4.5 otherwise.

The following code inlines as expected under -Os in 4.4. It also inlines properly with -O1+ in 4.5. But it generates giant bloated code under -Os in 4.5.

class Container {
public:
  Container() {
    member = new int;
  }

  void cleanup() {
    delete member;
    member = 0;
  }

  int value() {
    return *member;
  }

  ~Container() {
    cleanup();
  }
private:
  int *member;
};



int gimme() {
  Container m;
  return m.value();
}

Reply via email to