This is the mail archive of the gcc-bugs@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]

[Bug target/82447] [IVOPTS] Consider removing cmp instruction while iterating on an array of known bound


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82447

--- Comment #4 from amker at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #2)
> Indeed.  But when the body is:
>         sum += a[size - 1 - i];
> while base 128U with step -1U is considered, it isn't found as the cheapest
> for some reason either.

On 64-bit targets, candidate [128, -1] is added in unsigned int type, while
address IV has pointer type.  IVOPTs simply skips the candidate because it has
smaller precision than the IV use.
On 32-bit targets, I increased cost in case of invariant expression on purpose
in order to avoid generating too many invariant expressions.  So I think this
strategy works better for large cases but not for the simplest cases.  Probably
we should special case simple case with only one address type IV.

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