The following does away with the idea to use non-symmetrical
testing of mode_can_transfer_bits in hash-table equality testing.
It isn't feasible to always control query order to maintain
consistency.
PR tree-optimization/116406
* tree-ssa-sccvn.cc (vn_reference_eq): Never equate
float and int when the float mode cannot transfer bits.
Do not try to anticipate which is the mode we actually load
from.
* gcc.dg/tree-ssa/pr116406.c: New testcase.
* gcc.dg/tree-ssa/ssa-pre-30.c: On x86 dd -msse -mfpmath=sse.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Os -finstrument-functions-once" } */
+/* { dg-additional-options "-mfpmath=387" { target { x86_64-*-* i?86-*-* } } } */
+
+typedef union {
+ float f32;
+ double f64;
+ long i64;
+} U;
+
+_Bool
+foo (int c, U u)
+{
+ switch (c)
+ {
+ case 1:
+ return u.f32 - u.f64;
+ case 0:
+ return u.i64;
+ }
+}
/* { dg-do compile } */
/* { dg-require-effective-target int32 } */
/* { dg-options "-O2 -fdump-tree-pre-details" } */
+/* { dg-additional-options "-msse -mfpmath=sse" { target { x86_64-*-* i?86-*-* } } } */
int f;
int g;
return false;
}
else if (TYPE_MODE (vr1->type) != TYPE_MODE (vr2->type)
- && !mode_can_transfer_bits (TYPE_MODE (vr1->type)))
+ && (!mode_can_transfer_bits (TYPE_MODE (vr1->type))
+ || !mode_can_transfer_bits (TYPE_MODE (vr2->type))))
return false;
i = 0;