This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/80917] New: missed bit information propagation
- From: "drepper.fsp+rhbz at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 30 May 2017 06:50:25 +0000
- Subject: [Bug rtl-optimization/80917] New: missed bit information propagation
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80917
Bug ID: 80917
Summary: missed bit information propagation
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: drepper.fsp+rhbz at gmail dot com
Target Milestone: ---
Take the following code:
int f(unsigned a)
{
if ((a & 2) == 0)
return 0;
a += 4;
return (a & 2) != 0;
}
The addition clearly cannot affect the repeat of the test of the second bit.
Still, with the current trunk compiler I get with -O3 on x86-64:
xorl %eax, %eax
testb $2, %dil
je .L1
shrl %edi
movl %edi, %eax
andl $1, %eax
.L1:
ret
It might get quickly expansive but the bit set/unset information could be
tracked passed the test and through arithmetic operations like additions.