This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> writes:
> Hello,
>
> in the appended testcase (obtained from linux kernel), the following
> bug occurred: load motion decides to optimize non-volatile instance
> of src_pte, and not to take volatile instance into account. When
> checking for availability, we however consider these instances to be equal,
> which causes us to believe that the second load of pte is redundant.
>
> The patch fixes it.
>
> Zdenek
>
> typedef struct { unsigned long pte_low; } pte_t;
> static inline void clear_bit(int nr, volatile void * addr)
> {
> __asm__ __volatile__(
> "btrl %1,%0"
> :"=m" ((*(volatile long *) addr))
> :"Ir" (nr));
> }
> static inline void ptep_set_wrprotect(pte_t *ptep) { clear_bit(1, ptep); }
> int copy_page_range(void)
> {
> pte_t * src_pte;
> pte_t pte = *src_pte;
>
> if (pte.pte_low) {
> ptep_set_wrprotect(src_pte);
> pte = *src_pte;
> }
>
> foo (pte);
>
> return 0;
> }
Can you convert this into a testcase and add it also to the testsuite?
Andreas
>
> Changelog:
> * gcse.c (expr_equiv_p): Don't consider anything to be equal to
> volatile mem.
>
> Index: gcse.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
> retrieving revision 1.222.2.18
> diff -c -3 -p -r1.222.2.18 gcse.c
> *** gcse.c 15 Aug 2003 13:21:01 -0000 1.222.2.18
> --- gcse.c 29 Aug 2003 22:33:15 -0000
> *************** expr_equiv_p (x, y)
> *** 1844,1849 ****
> --- 1844,1853 ----
> due to it being set with the different alias set. */
> if (MEM_ALIAS_SET (x) != MEM_ALIAS_SET (y))
> return 0;
> +
> + /* A volatile mem should not be considered equivalent to any other. */
> + if (MEM_VOLATILE_P (x) || MEM_VOLATILE_P (y))
> + return 0;
> break;
>
> /* For commutative operations, check both orders. */
>
>
Andreas
--
Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
Attachment:
pgp00000.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |