Skip to content

poor codegen for code size #1668

@lattner

Description

@lattner
Bugzilla Link 1296
Resolution FIXED
Resolved on Feb 22, 2010 12:48
Version 1.0
OS All
CC @nlewycky

Extended Description

This contrived testcase:

int foo(int A, int B, int C) {
int i;
int result = 0;

if (A == 1) {
for (i = 0; i < 1000; ++i) {
if (i & B) {result = 1; break; }
}
} else if (A == 0) {
for (i = 0; i < 1000; ++i) {
if (i & C) {result = 1; break; }
}
} else if (A == 2) {
for (i = 0; i < 1000; ++i) {
if (i & C) {result = 1; break; }
}
}

out:
return result;
}

Produces silly code like this:

LBB1_19: #bb13.out.loopexit1_crit_edge
movl $1, %eax
jmp LBB1_15 #out
LBB1_20: #bb.out.loopexit_crit_edge
movl $1, %eax
jmp LBB1_15 #out
LBB1_21: #bb27.out.loopexit3_crit_edge
movl $1, %eax
jmp LBB1_15 #out

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions