[PATCH] [Annotalysis] Fix to get_canonical_lock_expr
Delesley Hutchins
delesley@google.com
Tue Jul 12 00:23:00 GMT 2011
This patch fixes get_canonical_lock_expr so that it works on lock
expressions that involve a MEM_REF. Gimple code can use either
MEM_REF or INDIRECT_REF in many expressions, and the choice of which
to use is somewhat arbitrary. The canonical form of a lock expression
must rewrite all MEM_REFs to INDIRECT_REFs to accurately compare
expressions. The surrounding "if" block prevented this rewrite from
happening in certain cases.
Bootstrapped and passed GCC regression testsuite on x86_64-unknown-linux-gnu.
Okay for branches/annotalysis and google/main?
-DeLesley
2011-07-06 DeLesley Hutchins <delesley@google.com>
* cp_get_virtual_function_decl.c (handle_call_gs): Changes
function to return null if the method cannot be found.
* thread_annot_lock-79.C: Additional annotalysis test cases
Index: gcc/tree-threadsafe-analyze.c
===================================================================
--- gcc/tree-threadsafe-analyze.c (revision 176188)
+++ gcc/tree-threadsafe-analyze.c (working copy)
@@ -959,19 +959,17 @@ get_canonical_lock_expr (tree lock, tree base_obj,
tree canon_base = get_canonical_lock_expr (base, base_obj,
true /* is_temp_expr */,
new_leftmost_base_var);
- if (base != canon_base)
- {
- /* If CANON_BASE is an ADDR_EXPR (e.g. &a), doing an indirect or
- memory reference on top of it is equivalent to accessing the
- variable itself. That is, *(&a) == a. So if that's the case,
- simply return the variable. Otherwise, build an indirect ref
- expression. */
- if (TREE_CODE (canon_base) == ADDR_EXPR)
- lock = TREE_OPERAND (canon_base, 0);
- else
- lock = build1 (INDIRECT_REF,
- TREE_TYPE (TREE_TYPE (canon_base)), canon_base);
- }
+
+ /* If CANON_BASE is an ADDR_EXPR (e.g. &a), doing an indirect or
+ memory reference on top of it is equivalent to accessing the
+ variable itself. That is, *(&a) == a. So if that's the case,
+ simply return the variable. Otherwise, build an indirect ref
+ expression. */
+ if (TREE_CODE (canon_base) == ADDR_EXPR)
+ lock = TREE_OPERAND (canon_base, 0);
+ else
+ lock = build1 (INDIRECT_REF,
+ TREE_TYPE (TREE_TYPE (canon_base)), canon_base);
break;
}
default:
--
DeLesley Hutchins | Software Engineer | delesley@google.com | 505-206-0315
More information about the Gcc-patches
mailing list