Skip to content

sdisel lowers this to really bad code #1297

@lattner

Description

@lattner
Bugzilla Link 925
Resolution FIXED
Resolved on Feb 22, 2010 12:50
Version 1.8
OS All

Extended Description

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions