Commit a88a7b22 by Eric Botcazou Committed by Eric Botcazou

tree-ssa-phiopt.c (factor_out_conditional_conversion): Remove redundant test and…

tree-ssa-phiopt.c (factor_out_conditional_conversion): Remove redundant test and bail out if the type of the new operand is not a...

	* 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.

From-SVN: r236748
parent 125f02ed
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> 2016-05-25 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.opt (ix86_target_flags_explicit): Remove. * 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> 2016-05-25 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
* c-c++-common/Wduplicated-cond-1.c: Use smaller const literal. * c-c++-common/Wduplicated-cond-1.c: Use smaller const literal.
......
-- { dg-do compile }
-- { dg-options "-O" }
package body Opt55 is
function Cond (B : Boolean; If_True, If_False : Date) return Date is
begin
if B then
return If_True;
else
return If_False;
end if;
end;
function F (C : Rec2; B : Boolean) return Date is
begin
return Cond (B, C.D1, C.D2);
end;
end Opt55;
package Opt55 is
type Date is record
D : Float;
end record;
type Rec1 (Kind : Boolean := False) is record
case Kind is
when True => N : Natural;
when False => null;
end case;
end record;
type Rec2 (D : Positive) is record
R : Rec1;
D1 : Date;
D2 : Date;
end record;
function F (C : Rec2; B : Boolean) return Date;
end Opt55;
...@@ -438,15 +438,18 @@ factor_out_conditional_conversion (edge e0, edge e1, gphi *phi, ...@@ -438,15 +438,18 @@ factor_out_conditional_conversion (edge e0, edge e1, gphi *phi,
/* Check if arg0 is an SSA_NAME and the stmt which defines arg0 is /* Check if arg0 is an SSA_NAME and the stmt which defines arg0 is
a conversion. */ a conversion. */
arg0_def_stmt = SSA_NAME_DEF_STMT (arg0); arg0_def_stmt = SSA_NAME_DEF_STMT (arg0);
if (!is_gimple_assign (arg0_def_stmt) if (!gimple_assign_cast_p (arg0_def_stmt))
|| !gimple_assign_cast_p (arg0_def_stmt))
return NULL; return NULL;
/* Use the RHS as new_arg0. */ /* Use the RHS as new_arg0. */
convert_code = gimple_assign_rhs_code (arg0_def_stmt); convert_code = gimple_assign_rhs_code (arg0_def_stmt);
new_arg0 = gimple_assign_rhs1 (arg0_def_stmt); new_arg0 = gimple_assign_rhs1 (arg0_def_stmt);
if (convert_code == VIEW_CONVERT_EXPR) 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) if (TREE_CODE (arg1) == SSA_NAME)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment