https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107919
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:b628cad9e093f7a33042fb9dd647f183394eefae commit r13-4408-gb628cad9e093f7a33042fb9dd647f183394eefae Author: Richard Biener <rguent...@suse.de> Date: Wed Nov 30 12:05:29 2022 +0100 tree-optimization/107919 - predicate simplification in uninit The testcase from the PR at -O2 shows ((_277 == 2) AND (_79 == 0)) OR ((NOT (_277 == 0)) AND (NOT (_277 > 2)) AND (NOT (_277 == 2)) AND (_79 == 0)) OR ((NOT (pretmp_300 == 255)) AND (_277 == 0) AND (NOT (_277 > 2)) AND (NOT (_277 == 2)) AND (_79 == 0)) which we fail to simplify. The following patch makes us simplify the relations on _277, producing ((_79 == 0) AND (_277 == 2)) OR ((_79 == 0) AND (_277 <= 1) AND (NOT (_277 == 0))) OR ((_79 == 0) AND (_277 == 0) AND (NOT (pretmp_300 == 255))) which might be an incremental step to resolve a bogus uninit diagnostic at -O2. The patch uses maybe_fold_and_comparison for this. PR tree-optimization/107919 * gimple-predicate-analysis.cc (simplify_1): Rename to ... (simplify_1a): .. this. (simplify_1b): New. (predicate::simplify): Call both simplify_1a and simplify_1b.