Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[passmgr] Eliminate use of typeid/dynamic_cast #1260

Closed
lattner opened this issue Aug 27, 2006 · 11 comments
Closed

[passmgr] Eliminate use of typeid/dynamic_cast #1260

lattner opened this issue Aug 27, 2006 · 11 comments
Labels

Comments

@lattner
Copy link
Collaborator

lattner commented Aug 27, 2006

Bugzilla Link 888
Resolution FIXED
Resolved on Jan 22, 2010 00:36
Version 1.0
OS All

Extended Description

The passmgr is the only significant user of RTTI data. If we could eliminate its use, we could build all of
LLVM with -fno-rtti, which is good for a 5-6% size reduction. This would also provide (slightly) faster
builds for everyone! :)

-Chris

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 25, 2007

The new PassManager continues to use typeid:

Pass.h: return lookupPassInfo(typeid(AnalysisClass));
PassSupport.h: : RegisterPassBase(Name, PassArg, typeid(PassName),
PassSupport.h: : RegisterAGBase(typeid(Interface),
&RPB.getPassInfo()->getTypeInfo(),
PassSupport.h: : RegisterAGBase(typeid(Interface)) {

and dynamic_cast:
PassAnalysisSupport.h: return dynamic_cast<AnalysisType*>
PassAnalysisSupport.h: // AnalysisGroups), we must use dynamic_cast here to
potentially adjust the
PassAnalysisSupport.h: AnalysisType Result =
dynamic_cast<AnalysisType
>(ResultPass);
PassAnalysisSupport.h: // AnalysisGroups), we must use dynamic_cast here to
potentially adjust the
PassAnalysisSupport.h: AnalysisType Result =
dynamic_cast<AnalysisType
>(ResultPass);

It would be nice if we could get rid of these and start turning on -no-rtti.

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 25, 2007

Devang,

Any chance this PR (888) could get implemented for 2.0?

Reid

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 26, 2007

I have not yet thought much about this. IMO, it is impractical to use isa,classof approach used by Value
and Type classes because it will require each pass to identify itself.

thoughts ? ideas ? suggestions ?

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 26, 2007

Every Pass already identifies itself when it registers. I don't see it as being
a big deal.

@lattner
Copy link
Collaborator Author

lattner commented Apr 26, 2007

One suggested implementation approach: Whenever a pass registration object's static ctor triggers, it
could assign a unique ID to the pass. The passmgr could use this.

Another approach: we could use the address of the pass registration object as a unique ID.

@llvmbot
Copy link
Collaborator

llvmbot commented May 1, 2007

I eliminated typeid uses.

@llvmbot
Copy link
Collaborator

llvmbot commented May 1, 2007

Cool! Thanks.

When I get a chance to test it, I'll turn typeid support off in the Makefiles
and see if we're "clean" without it. If so, I'll resolve this PR.

Thanks, Devang!

Reid

@llvmbot
Copy link
Collaborator

llvmbot commented May 1, 2007

Thanks Reid. I still need to deal with two remaining dynamic_cast in PassAnalysisSupport.h though.

@llvmbot
Copy link
Collaborator

llvmbot commented May 2, 2007

Okay, I'll watch for the commits. :)

@llvmbot
Copy link
Collaborator

llvmbot commented May 25, 2007

FYI, I turned off typeid support when building llvm-gcc and all hell broke
loose. It seems there are many other subtle uses. I'm just going on memory right
now but will provide details (or a fix) next week.

@lattner
Copy link
Collaborator Author

lattner commented Jan 22, 2010

Passmanager no longer uses RTTI.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
jeanPerier pushed a commit to jeanPerier/llvm-project that referenced this issue Jan 4, 2022
Remove slice op creation. Creating a slice for a vector subscript
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants