[gcc(refs/users/aoliva/heads/testme)] verbose fold_truth_andor_1 - extra
Alexandre Oliva
aoliva@gcc.gnu.org
Tue Sep 15 16:44:41 GMT 2020
https://gcc.gnu.org/g:c69fa64469470c7841b60f61fe6f49bcfb721a83
commit c69fa64469470c7841b60f61fe6f49bcfb721a83
Author: Alexandre Oliva <oliva@gnu.org>
Date: Tue Sep 15 13:32:23 2020 -0300
verbose fold_truth_andor_1 - extra
Diff:
---
gcc/fold-const.c | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index e91e7778999..b8e26c99fda 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -6227,6 +6227,8 @@ fold_truth_andor_1 (location_t loc, enum tree_code code, tree truth_type,
if (TREE_CODE_CLASS (lcode) != tcc_comparison
|| TREE_CODE_CLASS (rcode) != tcc_comparison)
{
+ bool report = true;
+
/* Check for the possibility of merging component references.
If any of our operands is another similar operation, recurse
to try to merge individual operands, but avoiding double
@@ -6246,27 +6248,37 @@ fold_truth_andor_1 (location_t loc, enum tree_code code, tree truth_type,
{
if ((result = fold_truth_andor_1 (loc, code, truth_type,
TREE_OPERAND (lhs, 1), rhs)) != 0)
- return fold_build2_loc (loc, code, truth_type,
- TREE_OPERAND (lhs, 0), result);
+ {
+ report = (TREE_CODE (TREE_OPERAND (lhs, 1)) == code
+ && TREE_TYPE (TREE_OPERAND (lhs, 1)) == truth_type);
+ result = fold_build2_loc (loc, code, truth_type,
+ TREE_OPERAND (lhs, 0), result);
+ }
+ else
if ((result = fold_truth_andor_1 (loc, code, truth_type,
TREE_OPERAND (lhs, 0), rhs)) != 0)
- return fold_build2_loc (loc, code, truth_type,
- result, TREE_OPERAND (lhs, 1));
+ result = fold_build2_loc (loc, code, truth_type,
+ result, TREE_OPERAND (lhs, 1));
}
else if (TREE_CODE_CLASS (lcode) == tcc_comparison
&& TREE_CODE (rhs) == code && TREE_TYPE (rhs) == truth_type)
{
if ((result = fold_truth_andor_1 (loc, code, truth_type, lhs,
TREE_OPERAND (rhs, 0))) != 0)
- return fold_build2_loc (loc, code, truth_type,
- result, TREE_OPERAND (rhs, 1));
+ result = fold_build2_loc (loc, code, truth_type,
+ result, TREE_OPERAND (rhs, 1));
+ else
if ((result = fold_truth_andor_1 (loc, code, truth_type, lhs,
TREE_OPERAND (rhs, 1))) != 0)
- return fold_build2_loc (loc, code, truth_type,
- result, TREE_OPERAND (rhs, 0));
+ result = fold_build2_loc (loc, code, truth_type,
+ result, TREE_OPERAND (rhs, 0));
}
- return 0;
+ if (report && result)
+ inform (loc, "extra merged %qT and %qT into %qT",
+ lhs, rhs, result);
+
+ return result;
}
ll_arg = TREE_OPERAND (lhs, 0);
@@ -6709,6 +6721,7 @@ fold_truth_andor_1 (location_t loc, enum tree_code code, tree truth_type,
llr_arg, llr_const);
result = build2_loc (loc, orig_code, truth_type,
lll_result, llr_result);
+ inform (loc, "merged extra %qT and %qT into %qT", lhs, rhs, result);
}
else
{
More information about the Gcc-cvs
mailing list