diff mbox

0002-Allow-constant-MEMs-through-calls.patch

Message ID 4C18F3B2.8080708@codesourcery.com
State New
Headers show

Commit Message

Maxim Kuvyrkov June 16, 2010, 3:54 p.m. UTC
The function gcse.c: compute_transpout() is responsible for filtering 
out expressions that do not survive function calls.  Certain kinds of 
memory references, e.g., references to read-only memory can safely be 
propagated through calls.  This patch improves compute_transpout() to 
allow that.

OK to apply?

Thank you,

Comments

Jeff Law June 16, 2010, 4:38 p.m. UTC | #1
> The function gcse.c: compute_transpout() is responsible for filtering 
> out expressions that do not survive function calls.  Certain kinds of 
> memory references, e.g., references to read-only memory can safely be 
> propagated through calls.  This patch improves compute_transpout() to 
> allow that.
>
> OK to apply?
OK.

Thanks,
Jeff
diff mbox

Patch

diff --git a/gcc/gcse.c b/gcc/gcse.c
index 1dbd2f0..00f3841 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -4083,6 +4083,12 @@  compute_transpout (void)
 		  && CONSTANT_POOL_ADDRESS_P (XEXP (expr->expr, 0)))
 		continue;
 
+	      /* Handle constant memory references, e.g., PIC addresses.
+		 We don't need to assume MEM_NOTRAP_P here because we only
+		 care about MEM's value surviving the call.  */
+	      if (MEM_READONLY_P (expr->expr) && !MEM_VOLATILE_P (expr->expr))
+		continue;
+
 	      /* ??? Optimally, we would use interprocedural alias
 		 analysis to determine if this mem is actually killed
 		 by this call.  */