https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99305
Bug ID: 99305
Summary: [11 Regression] range condition simplification after
inlining
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: nok.raven at gmail dot com
Target Milestone: ---
bool foo(char c)
{
return c >= '0' && c <= '9';
}
bool bar(char c)
{
return c != '\0' && foo(c);
}
bool foobar(char c)
{
return c != '\0' && c >= '0' && c <= '9';
}
// GCC 10
bar(char):
sub edi, 48
cmp dil, 9
setbe al
ret
// GCC 11
bar(char):
xor eax, eax
test dil, dil
je .L3
sub edi, 48
cmp dil, 9
setbe al
.L3:
ret
https://godbolt.org/z/z4r9cv