This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Shouldn't convert_scalars_to_vector call free_dominance_info?


On Thu, Mar 10, 2016 at 1:30 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Mar 10, 2016 at 1:24 PM, Jeff Law <law@redhat.com> wrote:
>> On 03/10/2016 01:18 PM, Richard Biener wrote:
>>>
>>> On March 10, 2016 6:02:58 PM GMT+01:00, "H.J. Lu" <hjl.tools@gmail.com>
>>> wrote:
>>>>
>>>> On Thu, Mar 10, 2016 at 6:57 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>>
>>>>> On Thu, Mar 10, 2016 at 5:49 AM, Jakub Jelinek <jakub@redhat.com>
>>>>
>>>> wrote:
>>>>>>
>>>>>> On Thu, Mar 10, 2016 at 05:43:27AM -0800, H.J. Lu wrote:
>>>>>>>>
>>>>>>>> free_dominance_info (CDI_DOMINATORS);
>>>>>>>
>>>>>>>
>>>>>>> Since convert_scalars_to_vector may add instructions, dominance
>>>>>>> info is no longer up to date.
>>>>>>
>>>>>>
>>>>>> Adding instructions doesn't change anything on the dominance info,
>>>>
>>>> just
>>>>>>
>>>>>> cfg manipulations that don't keep the dominators updated.
>>>>>> You can try to verify the dominance info at the end of the stv pass,
>>>>>
>>>>>
>>>>> I added
>>>>>
>>>>> verify_dominators (CDI_DOMINATORS);
>>>>> '
>>>>> It did trigger assert in my 64-bit STV pass in 64-bit libgcc build:
>>>>>
>>>>> /export/gnu/import/git/sources/gcc/libgcc/config/libbid/bid128_fma.c:
>>>>> In function \u2018add_and_round.constprop\u2019:
>>>>>
>>>>
>>>> /export/gnu/import/git/sources/gcc/libgcc/config/libbid/bid128_fma.c:629:1:
>>>>>
>>>>> error: dominator of 158 should be 107, not 101
>>>>>
>>>>> I will investigate.
>>>>
>>>>
>>>> Here is the problem:
>>>>
>>>> 1. I extended the STV pass to 64-bit to convert TI load/store to
>>>> V1TI load/store to use SSE load/store for 128-bit load/store.
>>>> 2. The 64-bit STV pass generates settings of CONST0_RTX and
>>>> CONSTM1_RTX to store 128-bit 0 and -1.
>>>> 3. I placed the 64-bit STV pass before the CSE pass so that
>>>> CONST0_RTX and CONSTM1_RTX generated by the STV pass
>>>> can be CSEed.
>>>> 4. After settings of CONST0_RTX and CONSTM1_RTX are CSEed,
>>>> dominance info will be wrong.
>>>
>>>
>>> Can't see how cse can ever invalidate dominators.
>>
>> cse can simplify jumps which can invalidate dominance information.
>>
>> But cse-ing CONST0_RTX and CONSTM1_RTX shouldn't invalidate dominators,
>> that's just utter nonsense -- ultimately it has to come down to changing
>> jumps.  ISTM HJ has more digging to do here.
>
> Not just CONST0_RTX and CONSTM1_RTX.  The new STV
> pass changes mode of SET from TImode to V1TImode which
> exposes more opportunities to CSE.
>

What I did is equivalent to

diff --git a/gcc/cse.c b/gcc/cse.c
index 2665d9a..43202a1 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -7644,7 +7644,11 @@ public:
       return optimize > 0 && flag_rerun_cse_after_loop;
     }

-  virtual unsigned int execute (function *) { return rest_of_handle_cse2 (); }
+  virtual unsigned int execute (function *)
+    {
+      calculate_dominance_info (CDI_DOMINATORS);
+      return rest_of_handle_cse2 ();
+    }

 }; // class pass_cse2


which leads to the same ICE:

/export/build/gnu/gcc/build-x86_64-linux/./gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/./gcc/
-B/usr/gcc-6.0.0/x86_64-pc-linux-gnu/bin/
-B/usr/gcc-6.0.0/x86_64-pc-linux-gnu/lib/ -isystem
/usr/gcc-6.0.0/x86_64-pc-linux-gnu/include -isystem
/usr/gcc-6.0.0/x86_64-pc-linux-gnu/sys-include    -O2 -g -O2  -O2 -g
-DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
-isystem ./include   -fpic -mlong-double-80 -DUSE_ELF_SYMVER -g
-DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -fpic
-mlong-double-80 -DUSE_ELF_SYMVER -I. -I. -I../.././gcc
-I/export/gnu/import/git/sources/gcc/libgcc
-I/export/gnu/import/git/sources/gcc/libgcc/.
-I/export/gnu/import/git/sources/gcc/libgcc/../gcc
-I/export/gnu/import/git/sources/gcc/libgcc/../include
-I/export/gnu/import/git/sources/gcc/libgcc/config/libbid
-DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS  -DUSE_TLS -S -g0
/export/gnu/import/git/sources/gcc/libgcc/config/libbid/bid128_fma.c
-o new.s
/export/gnu/import/git/sources/gcc/libgcc/config/libbid/bid128_fma.c:
In function âadd_and_round.constpropâ:
/export/gnu/import/git/sources/gcc/libgcc/config/libbid/bid128_fma.c:629:1:
error: dominator of 158 should be 107, not 101
 }
 ^
/export/gnu/import/git/sources/gcc/libgcc/config/libbid/bid128_fma.c:629:1:
internal compiler error: in verify_dominators, at dominance.c:1038
0x984b24 verify_dominators(cdi_direction)
/export/gnu/import/git/sources/gcc/gcc/dominance.c:1038
0x98287b checking_verify_dominators
/export/gnu/import/git/sources/gcc/gcc/dominance.h:71
0x984011 calculate_dominance_info(cdi_direction)
/export/gnu/import/git/sources/gcc/gcc/dominance.c:664
0x1742acc fwprop_init
/export/gnu/import/git/sources/gcc/gcc/fwprop.c:1393
0x1742da4 fwprop_addr
/export/gnu/import/git/sources/gcc/gcc/fwprop.c:1511
0x1742f0c execute
/export/gnu/import/git/sources/gcc/gcc/fwprop.c:1557
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]