Mercurial > hg > CbC > CbC_gcc
comparison gcc/tree-ssa-alias.c @ 47:3bfb6c00c1e0
update it from 4.4.2 to 4.4.3.
author | kent <kent@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 07 Feb 2010 17:44:34 +0900 |
parents | a06113de4d67 |
children | 77e2b8dfacca |
comparison
equal
deleted
inserted
replaced
46:b85a337e5837 | 47:3bfb6c00c1e0 |
---|---|
2333 referenced_var_iterator rvi; | 2333 referenced_var_iterator rvi; |
2334 tree var; | 2334 tree var; |
2335 size_t i; | 2335 size_t i; |
2336 | 2336 |
2337 timevar_push (TV_FLOW_INSENSITIVE); | 2337 timevar_push (TV_FLOW_INSENSITIVE); |
2338 | |
2339 /* Since this analysis is based exclusively on symbols, it fails to | |
2340 handle cases where two pointers P and Q have different memory | |
2341 tags with conflicting alias set numbers but no aliased symbols in | |
2342 common. | |
2343 | |
2344 For example, suppose that we have two memory tags SMT.1 and SMT.2 | |
2345 such that | |
2346 | |
2347 may-aliases (SMT.1) = { a } | |
2348 may-aliases (SMT.2) = { b } | |
2349 | |
2350 and the alias set number of SMT.1 conflicts with that of SMT.2. | |
2351 Since they don't have symbols in common, loads and stores from | |
2352 SMT.1 and SMT.2 will seem independent of each other, which will | |
2353 lead to the optimizers making invalid transformations (see | |
2354 testsuite/gcc.c-torture/execute/pr15262-[12].c). | |
2355 | |
2356 To avoid this problem, we do a final traversal of AI->POINTERS | |
2357 looking for pairs of pointers that have no aliased symbols in | |
2358 common and yet have conflicting alias set numbers. | |
2359 | |
2360 Note this has to be done first as we only can avoid adding | |
2361 aliases for common memory tag aliases, not for common symbol | |
2362 aliases as they might get pruned by the operand scanner later. */ | |
2363 for (i = 0; i < ai->num_pointers; i++) | |
2364 { | |
2365 size_t j; | |
2366 struct alias_map_d *p_map1 = ai->pointers[i]; | |
2367 tree tag1 = symbol_mem_tag (p_map1->var); | |
2368 bitmap may_aliases1 = MTAG_ALIASES (tag1); | |
2369 | |
2370 for (j = 0; j < ai->num_pointers; j++) | |
2371 { | |
2372 struct alias_map_d *p_map2 = ai->pointers[j]; | |
2373 tree tag2 = symbol_mem_tag (p_map2->var); | |
2374 bitmap may_aliases2 = may_aliases (tag2); | |
2375 | |
2376 /* By convention tags don't alias themselves. */ | |
2377 if (tag1 == tag2) | |
2378 continue; | |
2379 | |
2380 /* If the pointers may not point to each other, do nothing. */ | |
2381 if (!may_alias_p (p_map1->var, p_map1->set, tag2, p_map2->set, true)) | |
2382 continue; | |
2383 | |
2384 /* The two pointers may alias each other. If they already have | |
2385 symbols in common, do nothing. */ | |
2386 if (have_common_aliases_p (may_aliases1, may_aliases2)) | |
2387 continue; | |
2388 | |
2389 add_may_alias (tag1, tag2); | |
2390 } | |
2391 } | |
2392 | |
2338 /* For every pointer P, determine which addressable variables may alias | 2393 /* For every pointer P, determine which addressable variables may alias |
2339 with P's symbol memory tag. */ | 2394 with P's symbol memory tag. */ |
2340 for (i = 0; i < ai->num_pointers; i++) | 2395 for (i = 0; i < ai->num_pointers; i++) |
2341 { | 2396 { |
2342 size_t j; | 2397 size_t j; |
2363 if (may_alias_p (p_map->var, p_map->set, var, v_map->set, false)) | 2418 if (may_alias_p (p_map->var, p_map->set, var, v_map->set, false)) |
2364 { | 2419 { |
2365 /* Add VAR to TAG's may-aliases set. */ | 2420 /* Add VAR to TAG's may-aliases set. */ |
2366 add_may_alias (tag, var); | 2421 add_may_alias (tag, var); |
2367 } | 2422 } |
2368 } | |
2369 } | |
2370 | |
2371 /* Since this analysis is based exclusively on symbols, it fails to | |
2372 handle cases where two pointers P and Q have different memory | |
2373 tags with conflicting alias set numbers but no aliased symbols in | |
2374 common. | |
2375 | |
2376 For example, suppose that we have two memory tags SMT.1 and SMT.2 | |
2377 such that | |
2378 | |
2379 may-aliases (SMT.1) = { a } | |
2380 may-aliases (SMT.2) = { b } | |
2381 | |
2382 and the alias set number of SMT.1 conflicts with that of SMT.2. | |
2383 Since they don't have symbols in common, loads and stores from | |
2384 SMT.1 and SMT.2 will seem independent of each other, which will | |
2385 lead to the optimizers making invalid transformations (see | |
2386 testsuite/gcc.c-torture/execute/pr15262-[12].c). | |
2387 | |
2388 To avoid this problem, we do a final traversal of AI->POINTERS | |
2389 looking for pairs of pointers that have no aliased symbols in | |
2390 common and yet have conflicting alias set numbers. */ | |
2391 for (i = 0; i < ai->num_pointers; i++) | |
2392 { | |
2393 size_t j; | |
2394 struct alias_map_d *p_map1 = ai->pointers[i]; | |
2395 tree tag1 = symbol_mem_tag (p_map1->var); | |
2396 bitmap may_aliases1 = MTAG_ALIASES (tag1); | |
2397 | |
2398 for (j = 0; j < ai->num_pointers; j++) | |
2399 { | |
2400 struct alias_map_d *p_map2 = ai->pointers[j]; | |
2401 tree tag2 = symbol_mem_tag (p_map2->var); | |
2402 bitmap may_aliases2 = may_aliases (tag2); | |
2403 | |
2404 /* By convention tags don't alias themselves. */ | |
2405 if (tag1 == tag2) | |
2406 continue; | |
2407 | |
2408 /* If the pointers may not point to each other, do nothing. */ | |
2409 if (!may_alias_p (p_map1->var, p_map1->set, tag2, p_map2->set, true)) | |
2410 continue; | |
2411 | |
2412 /* The two pointers may alias each other. If they already have | |
2413 symbols in common, do nothing. */ | |
2414 if (have_common_aliases_p (may_aliases1, may_aliases2)) | |
2415 continue; | |
2416 | |
2417 add_may_alias (tag1, tag2); | |
2418 } | 2423 } |
2419 } | 2424 } |
2420 | 2425 |
2421 /* We have to add all HEAP variables to all SMTs aliases bitmaps. | 2426 /* We have to add all HEAP variables to all SMTs aliases bitmaps. |
2422 As we don't know which effective type the HEAP will have we cannot | 2427 As we don't know which effective type the HEAP will have we cannot |