[PATCH] Detect loops in find_comparison_args

Sandra Loosemore sandra@codesourcery.com
Thu Jul 26 20:36:00 GMT 2012


On 07/26/2012 01:28 AM, Paolo Bonzini wrote:
> Il 26/07/2012 04:25, Sandra Loosemore ha scritto:
>> On 07/25/2012 01:27 AM, Paolo Bonzini wrote:
>>>
>>> What I'm worried about is the extra cost of malloc-ing and free-ing
>>> the pointer set.  Perhaps you can skip the pointer set creation in
>>> the common case where find_comparison_args does not iterate?
>>> Something like this:
>>>
>>> [snip]
>>
>> I think this version is a little neater; it just defers
>> initialization of the pointer set to the end of the loop.
> 
> But the while condition could still fail right after you create the set,
> and I would expect that to be the common case.

Aha, I honestly couldn't figure out that was what you were trying to catch with the version you posted previously.

How about this one?  Tested as before.

-Sandra

2012-07-26  Andrew Jenner  <andrew@codesourcery.com>
	    Sandra Loosemore  <sandra@codesourcery.com>

	gcc/
	* cse.c (find_comparison_args): Check for cycles of any length.

	gcc/testsuite/
	* gcc.c-torture/compile/pr50380.c: Add code to cause cycle of length 2.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: cycles3.patch
Type: text/x-patch
Size: 2996 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120726/f661bd98/attachment.bin>


More information about the Gcc-patches mailing list