diff mbox

[1/4] Make SRA scalarize constant-pool loads

Message ID CAGWvnynH7OZ1+jqredtKJ-JY1dqaAf1T2WPyD5UwZw6pAYSEhg@mail.gmail.com
State New
Headers show

Commit Message

David Edelsohn Jan. 28, 2016, 12:14 a.m. UTC
On Wed, Jan 27, 2016 at 6:36 PM, Jeff Law <law@redhat.com> wrote:
> On 01/27/2016 12:39 PM, David Edelsohn wrote:
>>
>> The new sra-17.c and sra-18.c tests fail on AIX because the regex is
>> too restrictive -- AIX labels don't have exactly the same format.  On
>> AIX, the labels in the dumps look like "LC..0" instead of ".LC0".
>>
>> This patch adds "*" and ".*" so that the "." prepended to LC is
>> optional and to allow characters between the "LC" and the "0".
>>
>> I needed extra escapes for the sra-17.c line that matches multiple
>> times - for no apparent reason.
>
> The joys of expect/tcl.  I just keep escaping until the regex that I
> developed outside the suite works.  I have been trying to get away from
> using .* though.  The longest match nature sometimes gives surprising
> results.  In theory .*? ought to work better, but I haven't tried using it
> much.
>
> Anyway, the change looks fine to me.

Segher pointed out to me that my revised regex was matching multiple
lines, so it was not triggering multiple times without the restriction
on the pattern.

A revised, tighter patch uses "?"

+/* { dg-final { scan-tree-dump-times "Removing load: a =
\\\*\\.?LC\\.?\\.?0;" 1 "esra" } } */
+/* { dg-final { scan-tree-dump-times "SR\\.\[0-9_\]+ =
\\\*\\.?LC\\.?\\.?0\\.b\\\[0\\\]\\.f\\\[0\\\]\\.x" 1 "esra" } } */
+/* { dg-final { scan-tree-dump-times "SR\\.\[0-9_\]+ =
\\\*\\.?LC\\.?\\.?0\\.b\\\[0\\\]\\.f\\\[1\\\]\\.x" 1 "esra" } } */
+/* { dg-final { scan-tree-dump-times "SR\\.\[0-9_\]+ =
\\\*\\.?LC\\.?\\.?0\\.b\\\[1\\\]\\.f\\\[0\\\]\\.x" 1 "esra" } } */
+/* { dg-final { scan-tree-dump-times "SR\\.\[0-9_\]+ =
\\\*\\.?LC\\.?\\.?0\\.b\\\[1\\\]\\.f\\\[1\\\]\\.x" 1 "esra" } } */

Comments

Jeff Law Feb. 8, 2016, 7:58 p.m. UTC | #1
On 01/27/2016 05:14 PM, David Edelsohn wrote:
> On Wed, Jan 27, 2016 at 6:36 PM, Jeff Law <law@redhat.com> wrote:
>> On 01/27/2016 12:39 PM, David Edelsohn wrote:
>>>
>>> The new sra-17.c and sra-18.c tests fail on AIX because the regex is
>>> too restrictive -- AIX labels don't have exactly the same format.  On
>>> AIX, the labels in the dumps look like "LC..0" instead of ".LC0".
>>>
>>> This patch adds "*" and ".*" so that the "." prepended to LC is
>>> optional and to allow characters between the "LC" and the "0".
>>>
>>> I needed extra escapes for the sra-17.c line that matches multiple
>>> times - for no apparent reason.
>>
>> The joys of expect/tcl.  I just keep escaping until the regex that I
>> developed outside the suite works.  I have been trying to get away from
>> using .* though.  The longest match nature sometimes gives surprising
>> results.  In theory .*? ought to work better, but I haven't tried using it
>> much.
>>
>> Anyway, the change looks fine to me.
>
> Segher pointed out to me that my revised regex was matching multiple
> lines, so it was not triggering multiple times without the restriction
> on the pattern.
>
> A revised, tighter patch uses "?"
Yup, that's precisely why I've moved away from .* :-)

jeff
diff mbox

Patch

Index: sra-17.c
===================================================================
--- sra-17.c    (revision 232904)
+++ sra-17.c    (working copy)
@@ -15,5 +15,5 @@ 
   abort ();
 }

-/* { dg-final { scan-tree-dump-times "Removing load: a = \\\*.LC0;" 1
"esra" } } */
-/* { dg-final { scan-tree-dump-times "SR.\[0-9_\]+ = \\\*.LC0\\\[" 4
"esra" } } */
+/* { dg-final { scan-tree-dump-times "Removing load: a =
\\\*\\.?LC\\.?\\.?0;" 1 "esra" } } */
+/* { dg-final { scan-tree-dump-times "SR\\.\[0-9_\]+ =
\\\*\\.?LC\\.?\\.?0\\\[" 4 "esra" } } */
Index: sra-18.c
===================================================================
--- sra-18.c    (revision 232904)
+++ sra-18.c    (working copy)
@@ -21,8 +21,8 @@ 
   abort ();
 }

-/* { dg-final { scan-tree-dump-times "Removing load: a = \\\*.LC0;" 1
"esra" } } */
-/* { dg-final { scan-tree-dump-times "SR.\[0-9_\]+ =
\\\*.LC0\\.b\\\[0\\\]\\.f\\\[0\\\]\\.x" 1 "esra" } } */
-/* { dg-final { scan-tree-dump-times "SR.\[0-9_\]+ =
\\\*.LC0\\.b\\\[0\\\]\\.f\\\[1\\\]\\.x" 1 "esra" } } */
-/* { dg-final { scan-tree-dump-times "SR.\[0-9_\]+ =
\\\*.LC0\\.b\\\[1\\\]\\.f\\\[0\\\]\\.x" 1 "esra" } } */
-/* { dg-final { scan-tree-dump-times "SR.\[0-9_\]+ =
\\\*.LC0\\.b\\\[1\\\]\\.f\\\[1\\\]\\.x" 1 "esra" } } */