commit 0187c03be31a58ba561d535687dc00c94f0ff1aa
Author: Andrew MacLeod <amacleod@redhat.com>
Date: Sat Oct 30 11:00:49 2021 -0400
Don't register nonsensical relations.
gcc/
PR tree-optimization/103003
* value-relation.cc (dom_oracle::register_relation): If the 2
ssa names are the same, don't register any relation.
gcc/testsuite/
* gcc.dg/pr103003.c: New.
new file mode 100644
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+typedef char int8_t;
+int8_t c_4, uli_5;
+unsigned short us_6;
+void func_1() {
+ int uli_9;
+ short ptr_16ptr_11 = &uli_9; /* { dg-warning "initialization of*" } */
+ for (; us_6 <= 6;)
+ if ((us_6 *= uli_9) < (uli_5 || 0) ?: ((c_4 = us_6) >= us_6) - uli_5)
+ uli_9 = 9;
+}
@@ -877,7 +877,13 @@ relation_oracle::register_edge (edge e, relation_kind k, tree op1, tree op2)
void
dom_oracle::register_relation (basic_block bb, relation_kind k, tree op1,
tree op2)
-{ // Equivalencies are handled by the equivalence oracle.
+{
+ // If the 2 ssa_names are the same, do nothing. An equivalence is implied,
+ // and no other relation makes sense.
+ if (op1 == op2)
+ return;
+
+ // Equivalencies are handled by the equivalence oracle.
if (k == EQ_EXPR)
equiv_oracle::register_relation (bb, k, op1, op2);
else