aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fold-const.cc')
-rw-r--r--gcc/fold-const.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc
index 3e20538..c9471ea 100644
--- a/gcc/fold-const.cc
+++ b/gcc/fold-const.cc
@@ -1284,6 +1284,13 @@ poly_int_binop (poly_wide_int &res, enum tree_code code,
return false;
break;
+ case BIT_AND_EXPR:
+ if (TREE_CODE (arg2) != INTEGER_CST
+ || !can_and_p (wi::to_poly_wide (arg1), wi::to_wide (arg2),
+ &res))
+ return false;
+ break;
+
case BIT_IOR_EXPR:
if (TREE_CODE (arg2) != INTEGER_CST
|| !can_ior_p (wi::to_poly_wide (arg1), wi::to_wide (arg2),
@@ -7239,6 +7246,12 @@ tree_swap_operands_p (const_tree arg0, const_tree arg1)
if (TREE_CONSTANT (arg0))
return true;
+ /* Put invariant address in arg1. */
+ if (is_gimple_invariant_address (arg1))
+ return false;
+ if (is_gimple_invariant_address (arg0))
+ return true;
+
/* It is preferable to swap two SSA_NAME to ensure a canonical form
for commutative and comparison operators. Ensuring a canonical
form allows the optimizers to find additional redundancies without