bool bit_insertion;
bool string_concatenation;
bool only_constants;
+ bool consecutive;
unsigned int first_nonmergeable_order;
int lp_nr;
bit_insertion = info->rhs_code == BIT_INSERT_EXPR;
string_concatenation = info->rhs_code == STRING_CST;
only_constants = info->rhs_code == INTEGER_CST;
+ consecutive = true;
first_nonmergeable_order = ~0U;
lp_nr = info->lp_nr;
unsigned HOST_WIDE_INT align_bitpos = 0;
first_stmt = stmt;
}
+ if (info->bitpos != start + width)
+ consecutive = false;
+
/* We need to use extraction if there is any bit-field. */
if (info->rhs_code == BIT_INSERT_EXPR)
{
gcc_assert (!string_concatenation);
}
- /* We need to use concatenation if there is any string. */
+ /* We want to use concatenation if there is any string. */
if (info->rhs_code == STRING_CST)
{
string_concatenation = true;
gcc_assert (!bit_insertion);
}
+ /* But we cannot use it if we don't have consecutive stores. */
+ if (!consecutive)
+ string_concatenation = false;
+
if (info->rhs_code != INTEGER_CST)
only_constants = false;
}
void
merged_store_group::merge_into (store_immediate_info *info)
{
+ do_merge (info);
+
/* Make sure we're inserting in the position we think we're inserting. */
gcc_assert (info->bitpos >= start + width
&& info->bitregion_start <= bitregion_end);
width = info->bitpos + info->bitsize - start;
- do_merge (info);
}
/* Merge a store described by INFO into this merged store.
void
merged_store_group::merge_overlapping (store_immediate_info *info)
{
+ do_merge (info);
+
/* If the store extends the size of the group, extend the width. */
if (info->bitpos + info->bitsize > start + width)
width = info->bitpos + info->bitsize - start;
-
- do_merge (info);
}
/* Go through all the recorded stores in this group in program order and
--- /dev/null
+-- { dg-do run }
+-- { dg-options "-O2" }
+
+with Ada.Calendar; use Ada.Calendar;
+with Opt90a_Pkg; use Opt90a_Pkg;
+
+procedure Opt90a is
+ B : constant Integer := Year (Clock);
+ V : Data;
+
+begin
+ V := (R => (A => 0, B => B, C => "000000000000"));
+ if V.R.B /= B then
+ raise Program_Error;
+ end if;
+end;
--- /dev/null
+package Opt90a_Pkg is
+
+ type Rec is record
+ A : Short_Short_Integer;
+ B : Integer;
+ C : String (1 .. 12);
+ end record;
+ pragma Pack (Rec);
+ for Rec'Alignment use 1;
+
+ type Data is tagged record
+ R : Rec;
+ end record;
+
+end Opt90a_Pkg;
--- /dev/null
+-- { dg-do run }
+-- { dg-options "-O2" }
+
+with Ada.Calendar; use Ada.Calendar;
+with Opt90b_Pkg; use Opt90b_Pkg;
+
+procedure Opt90b is
+ B : constant Integer := Year (Clock);
+ V : Data;
+
+begin
+ V := (R => (A => 0, B => B, C => 0, D => "000000000000"));
+ if V.R.B /= B then
+ raise Program_Error;
+ end if;
+end;
--- /dev/null
+package Opt90b_Pkg is
+
+ type Rec is record
+ A : Short_Short_Integer;
+ B : Integer;
+ C : Short_Integer;
+ D : String (1 .. 12);
+ end record;
+ pragma Pack (Rec);
+ for Rec'Alignment use 1;
+
+ type Data is tagged record
+ R : Rec;
+ end record;
+
+end Opt90b_Pkg;
--- /dev/null
+-- { dg-do run }
+-- { dg-options "-O2" }
+
+with Ada.Calendar; use Ada.Calendar;
+with Opt90c_Pkg; use Opt90c_Pkg;
+
+procedure Opt90c is
+ B : constant Integer := Year (Clock);
+ V : Data;
+
+begin
+ V := (R => (A => 0, B => B, C => 0, D => "000000000000"));
+ if V.R.B /= B then
+ raise Program_Error;
+ end if;
+end;
--- /dev/null
+package Opt90c_Pkg is
+
+ type Rec is record
+ D : String (1 .. 12);
+ B : Integer;
+ A : Short_Short_Integer;
+ C : Short_Integer;
+ end record;
+ pragma Pack (Rec);
+ for Rec'Alignment use 1;
+
+ type Data is tagged record
+ R : Rec;
+ end record;
+
+end Opt90c_Pkg;
--- /dev/null
+-- { dg-do run }
+-- { dg-options "-O2" }
+
+with Ada.Calendar; use Ada.Calendar;
+with Opt90d_Pkg; use Opt90d_Pkg;
+
+procedure Opt90d is
+ B : constant Integer := Year (Clock);
+ V : Data;
+
+begin
+ V := (R => (A => 0, B => B, C => 0, D => "000000000000"));
+ if V.R.B /= B then
+ raise Program_Error;
+ end if;
+end;
--- /dev/null
+package Opt90d_Pkg is
+
+ type Rec is record
+ D : String (1 .. 12);
+ C : Short_Integer;
+ A : Short_Short_Integer;
+ B : Integer;
+ end record;
+ pragma Pack (Rec);
+ for Rec'Alignment use 1;
+
+ type Data is tagged record
+ R : Rec;
+ end record;
+
+end Opt90d_Pkg;
--- /dev/null
+-- { dg-do run }
+-- { dg-options "-O2" }
+
+with Ada.Calendar; use Ada.Calendar;
+with Opt90e_Pkg; use Opt90e_Pkg;
+
+procedure Opt90e is
+ B : constant Integer := Year (Clock);
+ V : Data;
+
+begin
+ V := (R => (A => 0, B => B, C => 0, D => "000000000000"));
+ if V.R.B /= B then
+ raise Program_Error;
+ end if;
+end;
--- /dev/null
+package Opt90e_Pkg is
+
+ type Rec is record
+ D : String (1 .. 12);
+ A : Short_Short_Integer;
+ B : Integer;
+ C : Short_Integer;
+ end record;
+ pragma Pack (Rec);
+ for Rec'Alignment use 1;
+
+ type Data is tagged record
+ R : Rec;
+ end record;
+
+end Opt90e_Pkg;