aboutsummaryrefslogtreecommitdiff
path: root/gcc/value-relation.cc
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2023-01-25 16:26:39 -0500
committerAndrew MacLeod <amacleod@redhat.com>2023-01-31 09:56:27 -0500
commit99fda5de368d84d97eb29a9f03e0d6039068f8b9 (patch)
tree8cd99fab7a800094f52a5d860454b126779c9549 /gcc/value-relation.cc
parent7f583a335769591d016caa51490e3e5dd50354fe (diff)
downloadgcc-99fda5de368d84d97eb29a9f03e0d6039068f8b9.zip
gcc-99fda5de368d84d97eb29a9f03e0d6039068f8b9.tar.gz
gcc-99fda5de368d84d97eb29a9f03e0d6039068f8b9.tar.bz2
Properly set GORI relation trios.
When relation trios were added to GORI, there was only one use. As they are utilized more by range-ops, it is apparent that the implelemtation was not complete. This patch fleshes it out completely so that every GORI operation has a complete relation trio. * gimple-range-gori.cc (gori_compute::compute_operand_range): Do not abort calculations if there is a valid relation available. (gori_compute::refine_using_relation): Pass correct relation trio. (gori_compute::compute_operand1_range): Create trio and use it. (gori_compute::compute_operand2_range): Ditto. * range-op.cc (operator_plus::op1_range): Use correct trio member. (operator_minus::op1_range): Use correct trio member. * value-relation.cc (value_relation::create_trio): New. * value-relation.h (value_relation::create_trio): New prototype.
Diffstat (limited to 'gcc/value-relation.cc')
-rw-r--r--gcc/value-relation.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc
index 5ca8a7e..f5b1e67 100644
--- a/gcc/value-relation.cc
+++ b/gcc/value-relation.cc
@@ -883,6 +883,40 @@ value_relation::apply_transitive (const value_relation &rel)
return false;
}
+// Create a trio from this value relation given LHS, OP1 and OP2.
+
+relation_trio
+value_relation::create_trio (tree lhs, tree op1, tree op2)
+{
+ relation_kind lhs_1;
+ if (lhs == name1 && op1 == name2)
+ lhs_1 = related;
+ else if (lhs == name2 && op1 == name1)
+ lhs_1 = relation_swap (related);
+ else
+ lhs_1 = VREL_VARYING;
+
+ relation_kind lhs_2;
+ if (lhs == name1 && op2 == name2)
+ lhs_2 = related;
+ else if (lhs == name2 && op2 == name1)
+ lhs_2 = relation_swap (related);
+ else
+ lhs_2 = VREL_VARYING;
+
+ relation_kind op_op;
+ if (op1 == name1 && op2 == name2)
+ op_op = related;
+ else if (op1 == name2 && op2 == name1)
+ op_op = relation_swap (related);
+ else if (op1 == op2)
+ op_op = VREL_EQ;
+ else
+ op_op = VREL_VARYING;
+
+ return relation_trio (lhs_1, lhs_2, op_op);
+}
+
// Dump the relation to file F.
void