public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][LTO,ARM] Fix vector TYPE_MODE in streaming-out
@ 2015-12-15 15:10 Christian Bruel
  2015-12-15 16:14 ` Bernd Schmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Bruel @ 2015-12-15 15:10 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1540 bytes --]

Hello,

This patch fixes a few ICEs that I'm having while enabling the ARM/NEON 
builtins for LTO (in a parallel development line, so the testcase is 
cannot work in isolation but should illustrate the problem)

For instance, the global declarations in the following code compiled 
with -mfpu=neon

----------------------------------
__simd64_int8_t a;
__simd128_int16_t e;

int
main()
{
    e = __builtin_neon_vaddlsv8qi (a, a);
    return 0;
}
----------------------------------


in "normal" mode, the TYPE_MODE for vector_type __simd64_int8_t is set 
to V8QImode by arm_vector_mode_supported_p during the builtins type 
initializations, thanks to TARGET_NEON set bu the global flag.

Now, in LTO mode the streamer writes the information for this 
vector_type as a scalar DImode, causing ICEs during arm_expand_builtin. 
The root cause of this is that the streamer-out uses TYPE_MODE in a 
context where the target_flags are not known return false for TARGET_NEON.

The streamer-in then will then read the wrong mode that propagates to 
the back-end.

Using the value computed by the middle end (when the current target was 
known) in type_common.mode instead of calling vector_type_mode during 
the LTO streaming fixes this issue.

Does that seem all-right to skip vector_type_mode dynamic machinery in 
the lto streamer since the streamer should not change modes used by the 
middle-end (I assume) ?

comments ?

many thanks

Christian

(for ref: this is a follow-up of 
https://gcc.gnu.org/ml/gcc-patches/2015-12/msg01094.html)







[-- Attachment #2: lto-attrvec.patch --]
[-- Type: text/x-patch, Size: 558 bytes --]

Index: tree-streamer-out.c
===================================================================
--- tree-streamer-out.c	(revision 231644)
+++ tree-streamer-out.c	(working copy)
@@ -308,7 +308,7 @@ pack_ts_function_decl_value_fields (stru
 static void
 pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr)
 {
-  bp_pack_machine_mode (bp, TYPE_MODE (expr));
+  bp_pack_machine_mode (bp, expr->type_common.mode);
   bp_pack_value (bp, TYPE_STRING_FLAG (expr), 1);
   /* TYPE_NO_FORCE_BLK is private to stor-layout and need
      no streaming.  */


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-17  9:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-15 15:10 [PATCH][LTO,ARM] Fix vector TYPE_MODE in streaming-out Christian Bruel
2015-12-15 16:14 ` Bernd Schmidt
2015-12-16  9:48   ` Richard Biener
2015-12-17  9:02     ` Christian Bruel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).