Skip to content

Simplification for (A ==/!= B) &/| (((cast)A) CMP C) #68514

Closed
@k-arrows

Description

@k-arrows

Example:
https://godbolt.org/z/Pr8T7xsMz

bool f(int a)
{
    bool t = a == 0;
    short t1 = a;
    bool t2 = t1 >= 3;
    return t & t2;
}

bool g(int b)
{
    bool t = b == 3;
    short t1 = b;
    bool t2 = t1 >= 3;
    return t | t2;
}

The example above is taken from the following:
https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gcc.dg/tree-ssa/cmpbit-6.c
https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gcc.dg/tree-ssa/cmpbit-7.c

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions