Bug 19652 - should always optimize constant second argument to strspn & Co. at compile time
Summary: should always optimize constant second argument to strspn & Co. at compile time
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: unknown
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-27 07:18 UTC by Alexander Melkov
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Melkov 2005-01-27 07:18:21 UTC
strspn, strcspn, strpbrk functions make a bitmap out of their second argument 
and then process their first argument using that bitmap.
If the second argument is a constant string, that bitmap should be built at the 
compile time, and strspn call be replaced with some intrinsic function that can 
use that bitmap.
Comment 1 Falk Hueffner 2005-01-27 09:02:56 UTC
(In reply to comment #0)
> strspn, strcspn, strpbrk functions make a bitmap out of their second argument 
> and then process their first argument using that bitmap.
> If the second argument is a constant string, that bitmap should be built at the 
> compile time, and strspn call be replaced with some intrinsic function that can 
> use that bitmap.

Well, with that we'd be wandering off far into libc land. While this kind of
optimization is nice, I wouldn't really want to have strspn code for 40
platforms in gcc to maintain (and if you're that desperate for speed, you
want platform-specific code). Alternatively, you could try to convince your
libc providers to include such functions in their libc, and then we might
implement calling them.
Comment 2 Andrew Pinski 2005-01-27 13:31:06 UTC
I am going to agree with Falk here, this is a hard problem to solve inside gcc. Again talk with you libc 
provider.