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 COMMITTED: Don't break tests for enum in range



No, I think on the contrary that TYPE_MIN/MAX_VALUE *is* a useful thing to have in the middle-end.
For what, if we don't want to do optimization based on it?
We don't *always* want to do optimization based on it.

That's a strange statement, either we want to do optimization based on them (and I'm of that opinion), or we don't. If we want to then we need to set them to sensible values, hence your suggestion to _not_ set MIN/MAX for enums seems to imply that you do not want to optimize based on that, i.e. you contradict yourself :-)

What I meant is that C++ rules forbid what would be (from VRP's eyes) a valid optimization. Hence, C++ semantics imply not to set the MIN/MAX for enums.


On the other hand, Ada shows that there are cases where the language semantics make such optimizations valid. In this case we should set MIN/MAX, but be careful to wrap the enum with a VIEW_CONVERT_EXPR when we want to avoid GCC's optimizations (mostly VRP).

Paolo


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