diff options
author | Richard Biener <rguenther@suse.de> | 2022-04-13 08:52:57 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2022-04-13 09:55:56 +0200 |
commit | 4e892de6774f86540d36385701aa7b0a2bba5155 (patch) | |
tree | c8e6b7fbf70609f17d6b62b3053a3fa30fe41873 /gcc/fold-const.cc | |
parent | 6e609e0010c76d708097cbcf1c67fded6010a0e0 (diff) | |
download | gcc-4e892de6774f86540d36385701aa7b0a2bba5155.zip gcc-4e892de6774f86540d36385701aa7b0a2bba5155.tar.gz gcc-4e892de6774f86540d36385701aa7b0a2bba5155.tar.bz2 |
tree-optimization/105250 - adjust fold_convertible_p PR105140 fix
The following reverts the original PR105140 fix and goes for instead
applying the additional fold_convert constraint for VECTOR_TYPE
conversions also to fold_convertible_p. I did not try sanitizing
all of this at this point.
2022-04-13 Richard Biener <rguenther@suse.de>
PR tree-optimization/105250
* fold-const.cc (fold_convertible_p): Revert
r12-7979-geaaf77dd85c333, instead check for size equality
of the vector types involved.
* gcc.dg/pr105250.c: New testcase.
Diffstat (limited to 'gcc/fold-const.cc')
-rw-r--r-- | gcc/fold-const.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index 7226bc5..a57ad07 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -2379,13 +2379,12 @@ build_zero_vector (tree type) return build_vector_from_val (type, t); } -/* Returns true, if ARG, an operand or a type, is convertible to TYPE - using a NOP_EXPR. */ +/* Returns true, if ARG is convertible to TYPE using a NOP_EXPR. */ bool fold_convertible_p (const_tree type, const_tree arg) { - const_tree orig = TYPE_P (arg) ? arg : TREE_TYPE (arg); + const_tree orig = TREE_TYPE (arg); if (type == orig) return true; @@ -2417,7 +2416,7 @@ fold_convertible_p (const_tree type, const_tree arg) return (VECTOR_TYPE_P (orig) && known_eq (TYPE_VECTOR_SUBPARTS (type), TYPE_VECTOR_SUBPARTS (orig)) - && fold_convertible_p (TREE_TYPE (type), TREE_TYPE (orig))); + && tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig))); default: return false; |