On Tue, Aug 11, 2020 at 6:15 AM Gary Oblock via Gcc <gcc@gcc.gnu.org> wrote: > > I'm trying to debug a problem cropping up in value range propagation. > Ironically I probably own an original copy 1995 copy of the paper it's > based on but that's not going to be much help since I'm lost in the > weeds. It's running on some optimization (my structure reorg > optimization) generated GIMPLE statements. > > Here's the GIMPLE dump: > > Function max_of_y (max_of_y, funcdef_no=1, decl_uid=4391, cgraph_uid=2, > symbol_order=20) (executed once) > > max_of_y (unsigned long data, size_t len) > { > double value; > double result; > size_t i; > > <bb 2> [local count: 118111600]: > field_arry_addr_14 = _reorg_base_var_type_t.y; > index_15 = (sizetype) data_27(D); > offset_16 = index_15 * 8; > field_addr_17 = field_arry_addr_14 + offset_16; > field_val_temp_13 = MEM <double> [(void *)field_addr_17]; > result_8 = field_val_temp_13; > goto <bb 6>; [100.00%] > > <bb 3> [local count: 955630225]: > _1 = i_3 * 16; > PPI_rhs1_cast_18 = (unsigned long) data_27(D); > PPI_rhs2_cast_19 = (unsigned long) _1; > PtrPlusInt_Adj_20 = PPI_rhs2_cast_19 / 16; > PtrPlusInt_21 = PPI_rhs1_cast_18 + PtrPlusInt_Adj_20; > dedangled_27 = (unsigned long) PtrPlusInt_21; > field_arry_addr_23 = _reorg_base_var_type_t.y; > index_24 = (sizetype) dedangled_27; > offset_25 = index_24 * 8; > field_addr_26 = field_arry_addr_23 + offset_25; > field_val_temp_22 = MEM <double> [(void *)field_addr_26]; > value_11 = field_val_temp_22; > if (result_5 < value_11) > goto <bb 4>; [50.00%] > else > goto <bb 5>; [50.00%] > > <bb 4> [local count: 477815112]: > > <bb 5> [local count: 955630225]: > # result_4 = PHI <result_5(3), value_11(4)> > i_12 = i_3 + 1; > > <bb 6> [local count: 1073741824]: > # i_3 = PHI <1(2), i_12(5)> > # result_5 = PHI <result_8(2), result_4(5)> > if (i_3 < len_9(D)) > goto <bb 3>; [89.00%] > else > goto <bb 7>; [11.00%] > > <bb 7> [local count: 118111600]: > # result_10 = PHI <result_5(6)> > return result_10; > } > > The failure in VRP is occurring on > > offset_16 = data_27(D) * 8; > > which is the from two adjacent statements above > > index_15 = (sizetype) data_27(D); > offset_16 = index_15 * 8; > > being merged together. > > Note, the types of index_15/16 are sizetype and data_27 is unsigned > long. > The error message is: > > internal compiler error: tree check: expected class ‘type’, have > ‘exceptional’ (error_mark) in to_wide,
This means the SSA name looked at is released and should no longer be refered from in the IL. > Things only start to look broken in value_range::lower_bound in > value-range.cc when > > return wi::to_wide (t); > > is passed error_mark_node in t. It's getting it from m_min just above. > My observation is that m_min is not always error_mark_node. In fact, I > seem to think you need to use set_varying to get this to even happen. > > Note, the ssa_propagation_engine processed the statement "offset_16 = > data..." multiple times before failing on it. What oh what is > happening and how in the heck did I cause it??? > > Please, somebody throw me a life preserver on this. > > Thanks, > > Gary > > > CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is > for the sole use of the intended recipient(s) and contains information that > is confidential and proprietary to Ampere Computing or its subsidiaries. It > is to be used solely for the purpose of furthering the parties' business > relationship. Any review, copying, or distribution of this email (or any > attachments thereto) is strictly prohibited. If you are not the intended > recipient, please contact the sender immediately and permanently delete the > original and any copies of this email and any attachments thereto.