Merge lp:~rsandifo/gcc-linaro/lp-705689 into lp:gcc-linaro/4.5

Proposed by Richard Sandiford
Status: Merged
Merged at revision: 99483
Proposed branch: lp:~rsandifo/gcc-linaro/lp-705689
Merge into: lp:gcc-linaro/4.5
Diff against target: 70 lines (+33/-7)
3 files modified
ChangeLog.linaro (+9/-0)
gcc/cse.c (+4/-7)
gcc/testsuite/gcc.dg/torture/volatile-pic-1.c (+20/-0)
To merge this branch: bzr merge lp:~rsandifo/gcc-linaro/lp-705689
Reviewer Review Type Date Requested Status
Andrew Stubbs (community) Approve
Review via email: mp+49367@code.launchpad.net

Description of the change

Stops delete_trivially_dead_insns from deleting the input to a volatile MEM.

To post a comment you must log in.
Revision history for this message
Andrew Stubbs (ams-codesourcery) wrote :

Applied and tested with no regressions. Approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog.linaro'
2--- ChangeLog.linaro 2011-02-08 12:07:29 +0000
3+++ ChangeLog.linaro 2011-02-11 11:02:30 +0000
4@@ -1,3 +1,12 @@
5+2011-02-11 Richard Sandiford <richard.sandiford@linaro.org>
6+
7+ gcc/
8+ * cse.c (count_reg_usage): Check side_effects_p. Remove the
9+ separate check for volatile asms.
10+
11+ gcc/testsuite/
12+ * gcc.dg/torture/volatile-pic-1.c: New test.
13+
14 2011-02-08 Andrew Stubbs <ams@codesourcery.com>
15
16 Backport from FSF mainline:
17
18=== modified file 'gcc/cse.c'
19--- gcc/cse.c 2010-11-26 12:03:32 +0000
20+++ gcc/cse.c 2011-02-11 11:02:30 +0000
21@@ -6634,9 +6634,10 @@
22 case CALL_INSN:
23 case INSN:
24 case JUMP_INSN:
25- /* We expect dest to be NULL_RTX here. If the insn may trap, mark
26- this fact by setting DEST to pc_rtx. */
27- if (insn_could_throw_p (x))
28+ /* We expect dest to be NULL_RTX here. If the insn may trap,
29+ or if it cannot be deleted due to side-effects, mark this fact
30+ by setting DEST to pc_rtx. */
31+ if (insn_could_throw_p (x) || side_effects_p (PATTERN (x)))
32 dest = pc_rtx;
33 if (code == CALL_INSN)
34 count_reg_usage (CALL_INSN_FUNCTION_USAGE (x), counts, dest, incr);
35@@ -6676,10 +6677,6 @@
36 return;
37
38 case ASM_OPERANDS:
39- /* If the asm is volatile, then this insn cannot be deleted,
40- and so the inputs *must* be live. */
41- if (MEM_VOLATILE_P (x))
42- dest = NULL_RTX;
43 /* Iterate over just the inputs, not the constraints as well. */
44 for (i = ASM_OPERANDS_INPUT_LENGTH (x) - 1; i >= 0; i--)
45 count_reg_usage (ASM_OPERANDS_INPUT (x, i), counts, dest, incr);
46
47=== added file 'gcc/testsuite/gcc.dg/torture/volatile-pic-1.c'
48--- gcc/testsuite/gcc.dg/torture/volatile-pic-1.c 1970-01-01 00:00:00 +0000
49+++ gcc/testsuite/gcc.dg/torture/volatile-pic-1.c 2011-02-11 11:02:30 +0000
50@@ -0,0 +1,20 @@
51+/* { dg-do run } */
52+/* { dg-require-visibility "" } */
53+/* { dg-require-effective-target fpic } */
54+/* { dg-options "-fPIC" } */
55+
56+volatile int x __attribute__((visibility("hidden")));
57+
58+void __attribute__((noinline)) bar (void)
59+{
60+#if defined (__arm__)
61+ asm volatile ("mov r3,%0" :: "r" (0xdeadbeef) : "r3");
62+#endif
63+ (void) x;
64+}
65+
66+int main (void)
67+{
68+ bar ();
69+ return 0;
70+}

Subscribers

People subscribed via source and target branches