Bug 38586 - quadratic behaviour in find_temp_slot_from_address.
Summary: quadratic behaviour in find_temp_slot_from_address.
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Steven Bosscher
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: compile-time-hog
Depends on:
Blocks: 38474
  Show dependency treegraph
 
Reported: 2008-12-20 11:28 UTC by Joost VandeVondele
Modified: 2009-01-04 00:17 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-12-20 15:46:05


Attachments
Add address -> temp slot map (3.85 KB, patch)
2009-01-03 00:36 UTC, Steven Bosscher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2008-12-20 11:28:15 UTC
This is split off from PR38474 for clarity, see steven's comment #35 in that PR.

Compiling the testcase of that PR 

(http://gcc.gnu.org/bugzilla/attachment.cgi?id=16873)

should be illuminating
Comment 1 Steven Bosscher 2009-01-03 00:36:58 UTC
Created attachment 17024 [details]
Add address -> temp slot map

Instead of huge list walks, just look up the address in the hash table and use the mapped temp slot of the address maps to a temp slot.
Comment 2 Richard Biener 2009-01-03 11:51:20 UTC
Ok.  Thanks.
Comment 3 Steven Bosscher 2009-01-04 00:16:12 UTC
Subject: Bug 38586

Author: steven
Date: Sun Jan  4 00:15:58 2009
New Revision: 143041

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143041
Log:
	PR middle-end/38586
	* function.c (struct temp_slot): Move to the section of the file
	that deals with temp slots.  Remove field 'address'.
	(temp_slot_address_table): New hash table of address -> temp slot.
	(struct temp_slot_address_entry): New struct, items for the table.
	(temp_slot_address_compute_hash, temp_slot_address_hash,
	temp_slot_address_eq, insert_temp_slot_address): Support functions
	for the new table.
	(find_temp_slot_from_address): Rewrite to use the new hash table.
	(remove_unused_temp_slot_addresses): Remove addresses of temp
	slots that have been made available.
	(remove_unused_temp_slot_addresses_1): Call-back for htab_traverse,
	worker function for remove_unused_temp_slot_addresses.
	(assign_stack_temp_for_type): Don't clear the temp slot address list.
	Add the temp slot address to the address -> temp slot map.
	(update_temp_slot_address): Update via insert_temp_slot_address.
	(free_temp_slots): Call remove_unused_temp_slot_addresses.
	(pop_temp_slots): Likewise.
	(init_temp_slots): Allocate the address -> temp slot map, or empty
	the map if it is already allocated.
	(prepare_function_start): Initialize temp slot processing.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/function.c

Comment 4 Steven Bosscher 2009-01-04 00:17:35 UTC
.