Message ID | 4C18F3B2.8080708@codesourcery.com |
---|---|
State | New |
Headers | show |
> 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 --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. */