summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99483.patch
blob: c0be4a03b184cccf41434f24f3043b5fc3fde812 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
2011-02-11  Richard Sandiford  <richard.sandiford@linaro.org>

	gcc/
	* cse.c (count_reg_usage): Check side_effects_p.  Remove the
	separate check for volatile asms.

	gcc/testsuite/
	* gcc.dg/torture/volatile-pic-1.c: New test.

=== modified file 'gcc/cse.c'
--- old/gcc/cse.c	2010-11-26 12:03:32 +0000
+++ new/gcc/cse.c	2011-02-11 09:27:19 +0000
@@ -6634,9 +6634,10 @@
     case CALL_INSN:
     case INSN:
     case JUMP_INSN:
-      /* We expect dest to be NULL_RTX here.  If the insn may trap, mark
-         this fact by setting DEST to pc_rtx.  */
-      if (insn_could_throw_p (x))
+      /* We expect dest to be NULL_RTX here.  If the insn may trap,
+	 or if it cannot be deleted due to side-effects, mark this fact
+	 by setting DEST to pc_rtx.  */
+      if (insn_could_throw_p (x) || side_effects_p (PATTERN (x)))
 	dest = pc_rtx;
       if (code == CALL_INSN)
 	count_reg_usage (CALL_INSN_FUNCTION_USAGE (x), counts, dest, incr);
@@ -6676,10 +6677,6 @@
       return;
 
     case ASM_OPERANDS:
-      /* If the asm is volatile, then this insn cannot be deleted,
-	 and so the inputs *must* be live.  */
-      if (MEM_VOLATILE_P (x))
-	dest = NULL_RTX;
       /* Iterate over just the inputs, not the constraints as well.  */
       for (i = ASM_OPERANDS_INPUT_LENGTH (x) - 1; i >= 0; i--)
 	count_reg_usage (ASM_OPERANDS_INPUT (x, i), counts, dest, incr);

=== added file 'gcc/testsuite/gcc.dg/torture/volatile-pic-1.c'
--- old/gcc/testsuite/gcc.dg/torture/volatile-pic-1.c	1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.dg/torture/volatile-pic-1.c	2011-02-11 09:27:19 +0000
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-require-visibility "" } */
+/* { dg-require-effective-target fpic } */
+/* { dg-options "-fPIC" } */
+
+volatile int x __attribute__((visibility("hidden")));
+
+void __attribute__((noinline)) bar (void)
+{
+#if defined (__arm__)
+  asm volatile ("mov r3,%0" :: "r" (0xdeadbeef) : "r3");
+#endif
+  (void) x;
+}
+
+int main (void)
+{
+  bar ();
+  return 0;
+}