diff options
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r-- | gcc/tree-ssa-pre.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index efa934fb853..ed337a39c46 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -599,7 +599,16 @@ get_expr_value_id (pre_expr expr) switch (expr->kind) { case CONSTANT: - return get_or_alloc_constant_value_id (PRE_EXPR_CONSTANT (expr)); + { + unsigned int id; + id = get_constant_value_id (PRE_EXPR_CONSTANT (expr)); + if (id == 0) + { + id = get_or_alloc_constant_value_id (PRE_EXPR_CONSTANT (expr)); + add_to_value (id, expr); + } + return id; + } case NAME: return VN_INFO (PRE_EXPR_NAME (expr))->value_id; case NARY: |