-
Notifications
You must be signed in to change notification settings - Fork 15k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillallvm:optimizationsmissed-optimization
Description
| Bugzilla Link | 51090 |
| Version | trunk |
| OS | Linux |
| CC | @fhahn,@ttheodor |
Extended Description
extern void foo(void);
int a;
short b(unsigned short c, int d) {
return d < 0 || c > (600 >> d) ? c : c << d;
}
int main() {
char f;
int g = 300;
while (a) {
f = g;
if (!b(f, 2)) {
foo();
g = 0;
}
}
return 0;
}commit 1a02aae introduced a regression
(for Target: x86_64-unknown-linux-gnu).
The generated asm (clang -S -c -O3) for main before that commit was:
main: # @​main
.Lmain$local:
.cfi_startproc
# %bb.0:
cmpl $0, .La$local(%rip)
je .LBB1_2
.p2align 4, 0x90
.LBB1_1: # =>This Inner Loop Header: Depth=1
jmp .LBB1_1
.LBB1_2:
xorl %eax, %eax
retq
.Lfunc_end1:
.size main, .Lfunc_end1-main
.cfi_endprocand after:
main: # @​main
.Lmain$local:
.cfi_startproc
# %bb.0:
pushq %rax
.cfi_def_cfa_offset 16
movl .La$local(%rip), %eax
testl %eax, %eax
je .LBB1_5
# %bb.1:
movl $300, %edx # imm = 0x12C
jmp .LBB1_2
.p2align 4, 0x90
.LBB1_4: # in Loop: Header=BB1_2 Depth=1
testl %eax, %eax
je .LBB1_5
.LBB1_2: # =>This Inner Loop Header: Depth=1
movsbl %dl, %ecx
movzwl %cx, %esi
cmpl $151, %esi
setb %cl
addb %cl, %cl
shll %cl, %esi
testw %si, %si
jne .LBB1_4
# %bb.3: # in Loop: Header=BB1_2 Depth=1
callq foo
xorl %edx, %edx
movl .La$local(%rip), %eax
jmp .LBB1_4
.LBB1_5:
xorl %eax, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
.Lfunc_end1:
.size main, .Lfunc_end1-main
.cfi_endprocMetadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillallvm:optimizationsmissed-optimization