* [PATCH, i386]: Fix PR 91528, ICE in ix86_expand_prologue
@ 2019-08-27 19:54 Uros Bizjak
0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2019-08-27 19:54 UTC (permalink / raw)
To: gcc-patches; +Cc: Richard Biener
[-- Attachment #1: Type: text/plain, Size: 850 bytes --]
When stack alignment is increased in convert_scalars_to_vector, we
have to update several other dependant fields in crtl struct, similar
to what expand_stack_alignment from cfgexpand.c does.
2019-08-27 Uroš Bizjak <ubizjak@gmail.com>
PR target/91528
* config/i386/i386-features.c (convert_scalars_to_vector):
Update crtl->stack_realign_needed, crtl->stack_realign_tried and
crtl->stack_realign_processed. Update crtl->drap_reg by calling
targetm.calls.get_drap_rtx. If drap_rtx is non-null then
Update crtl->args.internal_arg_pointer and call fixup_tail_calls.
testsuite/ChangeLog:
2019-08-27 Uroš Bizjak <ubizjak@gmail.com>
PR target/91528
* gcc.target/i386/pr91528.c: New test.
Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
Committed to mainline SVN.
Uros.
[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 1762 bytes --]
Index: config/i386/i386-features.c
===================================================================
--- config/i386/i386-features.c (revision 274958)
+++ config/i386/i386-features.c (working copy)
@@ -1651,6 +1651,32 @@ convert_scalars_to_vector (bool timode_p)
crtl->stack_alignment_needed = 128;
if (crtl->stack_alignment_estimated < 128)
crtl->stack_alignment_estimated = 128;
+
+ crtl->stack_realign_needed
+ = INCOMING_STACK_BOUNDARY < crtl->stack_alignment_estimated;
+ crtl->stack_realign_tried = crtl->stack_realign_needed;
+
+ crtl->stack_realign_processed = true;
+
+ if (!crtl->drap_reg)
+ {
+ rtx drap_rtx = targetm.calls.get_drap_rtx ();
+
+ /* stack_realign_drap and drap_rtx must match. */
+ gcc_assert ((stack_realign_drap != 0) == (drap_rtx != NULL));
+
+ /* Do nothing if NULL is returned,
+ which means DRAP is not needed. */
+ if (drap_rtx != NULL)
+ {
+ crtl->args.internal_arg_pointer = drap_rtx;
+
+ /* Call fixup_tail_calls to clean up
+ REG_EQUIV note if DRAP is needed. */
+ fixup_tail_calls ();
+ }
+ }
+
/* Fix up DECL_RTL/DECL_INCOMING_RTL of arguments. */
if (TARGET_64BIT)
for (tree parm = DECL_ARGUMENTS (current_function_decl);
Index: testsuite/gcc.target/i386/pr91528.c
===================================================================
--- testsuite/gcc.target/i386/pr91528.c (nonexistent)
+++ testsuite/gcc.target/i386/pr91528.c (working copy)
@@ -0,0 +1,14 @@
+/* PR target/91528 */
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-Os -mavx512vbmi2 -mforce-drap" } */
+
+extern long int labs (long int j);
+
+int
+main ()
+{
+ long *a = (long *)"empty";
+ int i = 1441516387;
+ a[i] = labs (a[i]);
+ return 0;
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-08-27 17:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-27 19:54 [PATCH, i386]: Fix PR 91528, ICE in ix86_expand_prologue Uros Bizjak
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).