Anthony Shipman - insufficient inline optimisation? (original) (raw)
This is the mail archive of the gcc@gcc.gnu.orgmailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] |
- From: Anthony Shipman
- To: gcc at gcc dot gnu dot org
- Date: Tue, 1 Nov 2005 23:07:39 +1100
- Subject: insufficient inline optimisation?
I have a C++ class and code that looks like this:
#include using namespace std;
class Z { public: Z() {} ~Z() {}
protected: int z_; };
int main(int argc, char** argv) { Z buf[100];
cout << sizeof(buf) << endl;
return 0;}
The compiler version is 4.01 (on Fedora 4). If I compile with -O0 then the creation of buf results in a loop being generated which calls the Z() constructor 100 times.
But then if I compile with -O the constructor will be inlined. The generated machine code contains a loop which does nothing 100 times: movl $100, %eax .L11: decl %eax jne .L11
I think that the optimiser should get rid of the loop once it has got rid of the body!
Should I submit this as a bug?
- Follow-Ups:
- Re: insufficient inline optimisation?
* From: Steven Bosscher - Re: insufficient inline optimisation?
* From: Andrew Pinski
- Re: insufficient inline optimisation?
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |