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 tree-optimization/77498] [7 regression] Performance drop after r239414 on spec2000/172mgrid


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

--- Comment #11 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> ---
(In reply to Thomas Preud'homme from comment #9)
> Sadly I could not come up with a minimal testcase so far. What I can see
> from the code is that tree code hoisting increases the live range of some
> values which then translates into more spilling in reload.
> 
> As an approximation I'm wondering if the maximum distance (computer in
> number of blocks traversed) from the definition to the use could be used to
> limit when the optimization is applied when optimizing for speed.

I finally managed. The bug can be reproduced by building the following for
arm-none-eabi with -S -O2 -mcpu=cortex-m7 and looking for the push in the
resulting assembly code.

fn1() {
  char *a;
  char b;
  for (; *a; a++) {
    if (b)
      a++;
    fn2();
  }
}

With -O2: r3, r4, r5 and lr and pushed.
With -O2 -fno-code-hoisting: r4 and lr are pushed only.


Similarly for -mcpu=cortex-m0plus:

enum { ENUM1, ENUM2, ENUM3 } a;
fn1() {
  char *b;
  for (; *b && a != ENUM2; b++)
    switch (a) {
      case ENUM1: a = ENUM3;
    }
}

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