diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-01-05 19:13:29 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-01-05 19:13:29 +0100 |
commit | 5de7bf5bc98ec9edc6838a443521204d0eca7605 (patch) | |
tree | 388829cc39978cb2685f30f05b83652575aec353 /gcc/expr.h | |
parent | 6b577a17b26347e78c8b9167f24fc5c9d9724270 (diff) | |
download | gcc-5de7bf5bc98ec9edc6838a443521204d0eca7605.zip gcc-5de7bf5bc98ec9edc6838a443521204d0eca7605.tar.gz gcc-5de7bf5bc98ec9edc6838a443521204d0eca7605.tar.bz2 |
expand: Fold x - y < 0 to x < y during expansion [PR94802]
My earlier patch to simplify x - y < 0 etc. for signed subtraction
with undefined overflow into x < y in match.pd regressed some tests,
even when it was guarded to be post-IPA, the following patch thus
attempts to optimize that during expansion instead (which is the last
time we can do it, afterwards we lose the information whether it was
x - y < 0 or (int) ((unsigned) x - y) < 0 for which we couldn't
optimize it.
2021-01-05 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/94802
* expr.h (maybe_optimize_sub_cmp_0): Declare.
* expr.c: Include tree-pretty-print.h and flags.h.
(maybe_optimize_sub_cmp_0): New function.
(do_store_flag): Use it.
* cfgexpand.c (expand_gimple_cond): Likewise.
* gcc.target/i386/pr94802.c: New test.
* gcc.dg/Wstrict-overflow-25.c: Remove xfail.
Diffstat (limited to 'gcc/expr.h')
-rw-r--r-- | gcc/expr.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -298,6 +298,7 @@ extern tree string_constant (tree, tree *, tree *, tree *); extern tree byte_representation (tree, tree *, tree *, tree *); extern enum tree_code maybe_optimize_mod_cmp (enum tree_code, tree *, tree *); +extern void maybe_optimize_sub_cmp_0 (enum tree_code, tree *, tree *); /* Two different ways of generating switch statements. */ extern int try_casesi (tree, tree, tree, tree, rtx, rtx, rtx, profile_probability); |