From 41fac672b8f412b67e502dff0f9b03af6ceaef73 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Sun, 8 Mar 2009 17:09:11 +0000 Subject: [PATCH 1/1] analysis of address_tkane for union types is not that easy - be conservative [r25640] --- ir/ana/irmemory.c | 9 +++++++++ ir/opt/scalar_replace.c | 8 ++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ir/ana/irmemory.c b/ir/ana/irmemory.c index db0aa7c87..66ccccbde 100644 --- a/ir/ana/irmemory.c +++ b/ir/ana/irmemory.c @@ -850,7 +850,16 @@ static ir_entity_usage determine_entity_usage(const ir_node *irn, ir_entity *ent case iro_Add: case iro_Sub: + /* Check the successor of irn. */ + res |= determine_entity_usage(succ, entity); + break; case iro_Sel: { + ir_entity *entity = get_Sel_entity(succ); + /* this analyis can't handle unions correctly */ + if (is_Union_type(get_entity_owner(entity))) { + red |= ir_usage_unknown; + break; + } /* Check the successor of irn. */ res |= determine_entity_usage(succ, entity); break; diff --git a/ir/opt/scalar_replace.c b/ir/opt/scalar_replace.c index 5e7a00e95..276baf3b5 100644 --- a/ir/opt/scalar_replace.c +++ b/ir/opt/scalar_replace.c @@ -211,9 +211,13 @@ int is_address_taken(ir_node *sel) break; case iro_Sel: { + ir_entity* entity = get_Sel_entity(succ); + /* we can't handle unions correctly yet -> address taken */ + if (is_Union_type(get_entity_owner(entity))) + return 1; + /* Check the Sel successor of Sel */ int res = is_address_taken(succ); - if (res) return 1; break; @@ -682,7 +686,7 @@ int scalar_replacement_opt(ir_graph *irg) { /* Call algorithm that computes the out edges */ assure_irg_outs(irg); - /* we use the link firld to store the VNUM */ + /* we use the link field to store the VNUM */ ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK); irp_reserve_resources(irp, IR_RESOURCE_ENTITY_LINK); -- 2.20.1