This is the mail archive of the gcc-patches@gcc.gnu.org mailing 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]

Re: [PATCH] Fix overzealous folding


Richard Guenther wrote:
Why?  TYPE_{MIN,MAX}_VALUE seems like it's giving useful information to the
optimizer.  That is a way in which enums and ints are different; why not let
the optimizer take advantage?

The situation that concerns me is that, if I understand correctly, Eric's
patch is going to make:

enum E { low = INT_MIN, high = INT_MAX };

behave different from "int" -- and I don't think it should.

But the only difference between this enum and int is their TYPE_MIN/MAX_VALUE. So either you want the optimizer to take advantage of that difference or not.

For the enum above, there's no difference in TYPE_{MIN,MAX}_VALUE from int. So, I want them treated the same.


For:

enum E { low = 0, high = 1 };

there is a difference, and I want the optimizer to take advantage of that fact.

Eric's patch makes all ENUMERAL_TYPEs be treated different from INTEGER_TYPEs. I think that's wrong because whether a type is declared as an enum or not should not in itself make a difference. What does make a difference is the range of the type. If Eric's patch was checking the ranges in some logical way, then I wouldn't object.

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]