This is an archive of the discontinued LLVM Phabricator instance.

[TableGen] Remove unnecessary TypeSetByHwMode -> ValueTypeByHwMode -> TypeSetByHwMode conversions in getPatternSize
ClosedPublic

Authored by RKSimon on Aug 15 2018, 10:16 AM.

Details

Summary

I noticed this during profiling of tablegen (PR28222) that we were calling Child->getType(0) which creates a ValueTypeByHwMode on the fly from the requested internal TypeSetByHwMode type and returns it by value, we then treat it as a TypeSetByHwMode reference which involves constructing a new TypeSetByHwMode on the stack with a large amount of std::map iterating/copying all along the way.

I am not an expert on tablegen so please check my working, but AFAICT this is all unnecessary and we should be calling Child->getExtType(0) which returns the original TypeSetByHwMode by reference.

This gives me a 90sec reduction in msvc debug builds of x86 -gen-dag-isel.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Aug 15 2018, 10:16 AM

This looks great. I've tried to reduce the MSVC debug build time as well,
but I didn't find this particular problem. I can't comment on the
correctness since I don't know much about how tablegen is implemented, but
I just wanted to say that this kind of thing is very appreciated and I hope
you continue doing more of it :)

kparzysz accepted this revision.Aug 15 2018, 10:58 AM
This revision is now accepted and ready to land.Aug 15 2018, 10:58 AM
This revision was automatically updated to reflect the committed changes.