Skip to content
Snippets Groups Projects
Commit ddd64a6e authored by Andrew Pinski's avatar Andrew Pinski
Browse files

MATCH: remove negate for 1bit types

For 1bit types, negate is either undefined or don't change the value.
In either cases we want to remove them.
This patch adds a match pattern to do that.
Also converting to a 1bit type we can remove the negate just like we already do
for `&1` so this patch adds that too.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Notes on the testcases:
This patch is the last part to fix PR 95929; cond-bool-2.c testcase.
bit1neg-1.c is a 1bit-field testcase where we could remove the assignment
all the way in one case (which happened on the RTL level for some targets but not all).
cond-bool-2.c is the reduced testcase of PR 95929.

	PR tree-optimization/95929

gcc/ChangeLog:

	* match.pd (convert?(-a)): New pattern
	for 1bit integer types.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/bit1neg-1.c: New test.
	* gcc.dg/tree-ssa/cond-bool-1.c: New test.
	* gcc.dg/tree-ssa/cond-bool-2.c: New test.
parent 7e05cd63
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment