[LLVMbugs] [Bug 925] NEW: sdisel lowers this to really bad code

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Sep 26 23:26:59 PDT 2006


http://llvm.org/bugs/show_bug.cgi?id=925

           Summary: sdisel lowers this to really bad code
           Product: libraries
           Version: 1.8
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sabre at nondot.org


In the stupid contrived testcase below, sdisel is breaking *every* critical edge from the switch to the 
blahaha block, creating a ton of duplicated code and making switch lowering uglier than it should be.

void foo(int C) {
  const char *s = "blah";

  switch (C) {
  case 1 ... 10:
    s = "bonk";
    goto blahaha;
  }
  s = "bork";
  if (C & 123)  s = "perfwap";

blahaha:
  printf(s);
  printf(s);
  printf(s);
  printf(s);
  printf(s);
  printf(s);
  printf(s);
  printf(s);
  printf(s);
  printf(s);
  printf(s);
  printf(s);
  printf(s);
}

We end up with code like this:

LBB1_1: #entry.blahaha_crit_edge9
        movl $_str1, %esi
        jmp LBB1_14     #blahaha
LBB1_2: #entry.blahaha_crit_edge8
        movl $_str1, %esi
        jmp LBB1_14     #blahaha
LBB1_3: #entry.blahaha_crit_edge7
        movl $_str1, %esi
        jmp LBB1_14     #blahaha
LBB1_4: #entry.blahaha_crit_edge6
        movl $_str1, %esi
        jmp LBB1_14     #blahaha
LBB1_5: #entry.blahaha_crit_edge5
        movl $_str1, %esi
        jmp LBB1_14     #blahaha
...

When splitting critical edges into a block, SDIsel should factor all edges from a particular BB into a 
single split block. 

-Chris



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list