https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79992

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-03-10
          Component|c++                         |tree-optimization
     Ever confirmed|0                           |1

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
After inlining:
  [t1.cc:17:42] D.36139 = D.36138;
  [t1.cc:17:42] D.36138 ={v} {CLOBBER};
  D.36137 = D.36139;
  [t1.cc:30:38] need_pie_2 = D.36137;
  _39 = [t1.cc:31:28] MEM[(const int * *)&need_pie_2 + 8B];


That looks ok, the clobber is only of 36138, we use 36139, and then use 36137.

After ESRA:
  [t1.cc:24:33] SR.18_42 = 1;
  SR.17_1 = SR.18_42;
  [t1.cc:28:38] base_f$__i_28 = SR.17_1;
  [t1.cc:16:35] need_pie_1_17 = base_f$__i_28;
  [t1.cc:10:9] MEM[(struct  &)[t1.cc:17:42] &D.36138] ={v} {CLOBBER};
  [t1.cc:10:47] [t1.cc:10:47] MEM[(struct __lambda0 *)&D.36138] =
need_pie_1_17;
  [t1.cc:10:47] [t1.cc:10:47] D.36138.v = [t1.cc:24:29] &[t1.cc:24:20]
MEM[(const struct __lambda0 *)[t1.cc:17:42] &D.36138].__i;
  [t1.cc:17:42] D.36139 = D.36138;
  [t1.cc:17:42] SR.15_24 = [t1.cc:17:42] MEM[(struct need_pie_2 *)&D.36138];
  [t1.cc:17:42] SR.16_53 = [t1.cc:17:42] MEM[(struct need_pie_2 *)&D.36138 +
8B];
  [t1.cc:17:42] D.36138 ={v} {CLOBBER};
  SR.13_21 = SR.15_24;
  SR.14_20 = SR.16_53;
  [t1.cc:30:38] need_pie_2_54 = SR.13_21;
  [t1.cc:30:38] need_pie_2$8_25 = SR.14_20;
  _39 = need_pie_2$8_25;
  [t1.cc:32:11] _2 = [t1.cc:32:11] *_39;


Looks find so far.

And then after fre:
  [t1.cc:10:9] MEM[(struct  &)[t1.cc:17:42] &D.36138] ={v} {CLOBBER};
  [t1.cc:10:47] [t1.cc:10:47] MEM[(struct __lambda0 *)&D.36138] = 1;
  [t1.cc:10:47] [t1.cc:10:47] D.36138.v = [t1.cc:24:29] &[t1.cc:24:20]
MEM[(const struct __lambda0 *)[t1.cc:17:42] &D.36138].__i;
  [t1.cc:17:42] D.36139 = D.36138;
  [t1.cc:17:42] D.36138 ={v} {CLOBBER};
  [t1.cc:32:11] _2 = [t1.cc:32:11] MEM[(const int *)&D.36138];

So FRE messes up.

Reply via email to