This is the mail archive of the 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/33302] New: follow-up on bug 33291 dead-store not eliminated

This is a follow-up on bug 33291. It uses the same testcase (repeated here) but
with some additional optimization flags.

struct Clock {
 void f();
 void add(unsigned n) { a += n; }
 int a;

struct CPU : Clock {
 virtual ~CPU();
 unsigned char readSlow();
 void execute();

 void delay() { add(2); }
 unsigned char readFast() {
  if (unsigned char* p = ptrs[addr >> 8]) {
   // fast-path
   return p[addr & 255];
  } else {
   // slow-path
   return readSlow();

 typedef void (CPU::*FuncPtr)();
 static FuncPtr tab[256];
 unsigned char* ptrs[256];
 unsigned addr;

void CPU::execute() {
 while (true) {
  unsigned char b = readFast();

When compiled with SVN revision 128074 on a linux x86_64 machine:

> g++ -O3 -fforce-addr -ftracer -S CPU.ii
> cat CPU.s
    movl    (%rbx), %eax
    leal    4(%rax), %edx
    addl    $6, %eax
    movl    %edx, (%rbx)       #### dead store
    movzbl  (%r12), %edx
    movzbl  (%rcx,%rdx), %edx
    movl    %eax, (%rbx)

           Summary: follow-up on bug 33291   dead-store not eliminated
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wouter dot vermaelen at scarlet dot be

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