+2016-05-25 Eric Botcazou <ebotcazou@adacore.com>
+
+ * tree-ssa-phiopt.c (factor_out_conditional_conversion): Remove
+ redundant test and bail out if the type of the new operand is not
+ a GIMPLE register type after stripping a VIEW_CONVERT_EXPR.
+
2016-05-25 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.opt (ix86_target_flags_explicit): Remove.
+2016-05-25 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt55.ad[sb]: New test.
+
2016-05-25 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
* c-c++-common/Wduplicated-cond-1.c: Use smaller const literal.
--- /dev/null
+-- { dg-do compile }\r
+-- { dg-options "-O" }\r
+\r
+package body Opt55 is\r
+\r
+ function Cond (B : Boolean; If_True, If_False : Date) return Date is\r
+ begin\r
+ if B then\r
+ return If_True;\r
+ else\r
+ return If_False;\r
+ end if;\r
+ end;\r
+\r
+ function F (C : Rec2; B : Boolean) return Date is\r
+ begin\r
+ return Cond (B, C.D1, C.D2);\r
+ end;\r
+\r
+end Opt55;\r
--- /dev/null
+package Opt55 is\r
+\r
+ type Date is record\r
+ D : Float;\r
+ end record;\r
+\r
+ type Rec1 (Kind : Boolean := False) is record\r
+ case Kind is\r
+ when True => N : Natural;\r
+ when False => null;\r
+ end case;\r
+ end record;\r
+\r
+ type Rec2 (D : Positive) is record\r
+ R : Rec1;\r
+ D1 : Date;\r
+ D2 : Date;\r
+ end record;\r
+\r
+ function F (C : Rec2; B : Boolean) return Date;\r
+\r
+end Opt55;\r
/* Check if arg0 is an SSA_NAME and the stmt which defines arg0 is
a conversion. */
arg0_def_stmt = SSA_NAME_DEF_STMT (arg0);
- if (!is_gimple_assign (arg0_def_stmt)
- || !gimple_assign_cast_p (arg0_def_stmt))
+ if (!gimple_assign_cast_p (arg0_def_stmt))
return NULL;
/* Use the RHS as new_arg0. */
convert_code = gimple_assign_rhs_code (arg0_def_stmt);
new_arg0 = gimple_assign_rhs1 (arg0_def_stmt);
if (convert_code == VIEW_CONVERT_EXPR)
- new_arg0 = TREE_OPERAND (new_arg0, 0);
+ {
+ new_arg0 = TREE_OPERAND (new_arg0, 0);
+ if (!is_gimple_reg_type (TREE_TYPE (new_arg0)))
+ return NULL;
+ }
if (TREE_CODE (arg1) == SSA_NAME)
{