diff options
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r-- | gcc/tree-ssa-structalias.c | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 407ad37..89135ea 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -2849,41 +2849,33 @@ lookup_vi_for_tree (tree t) static const char * alias_get_name (tree decl) { - const char *res = NULL; - char *temp; - - if (!dump_file) - return "NULL"; - - if (TREE_CODE (decl) == SSA_NAME) - { - res = get_name (decl); - if (res) - temp = xasprintf ("%s_%u", res, SSA_NAME_VERSION (decl)); - else - temp = xasprintf ("_%u", SSA_NAME_VERSION (decl)); - res = ggc_strdup (temp); - free (temp); - } - else if (DECL_P (decl)) + const char *res = "NULL"; + if (dump_file) { - if (DECL_ASSEMBLER_NAME_SET_P (decl)) - res = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - else + char *temp = NULL; + if (TREE_CODE (decl) == SSA_NAME) + { + res = get_name (decl); + temp = xasprintf ("%s_%u", res ? res : "", SSA_NAME_VERSION (decl)); + } + else if (HAS_DECL_ASSEMBLER_NAME_P (decl) + && DECL_ASSEMBLER_NAME_SET_P (decl)) + res = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME_RAW (decl)); + else if (DECL_P (decl)) { res = get_name (decl); if (!res) - { - temp = xasprintf ("D.%u", DECL_UID (decl)); - res = ggc_strdup (temp); - free (temp); - } + temp = xasprintf ("D.%u", DECL_UID (decl)); + } + + if (temp) + { + res = ggc_strdup (temp); + free (temp); } } - if (res != NULL) - return res; - return "NULL"; + return res; } /* Find the variable id for tree T in the map. |