[PATCH] D43595: WIP alternative to r325686 (Implement name based structure type mapping).

Rafael Avila de Espindola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 14:49:46 PST 2018


espindola created this revision.
espindola added reviewers: tejohnson, pcc, dblaikie, evgeny777.
Herald added a subscriber: mgorny.

The long term idea on how to improve the llvm type system is to have a single pointer type which makes the type graph a DAG.

Before that we need some heuristics as graph isomorphism has no known fast algorithm.

One of the heuristics we have is based on the name of the type. That is fairly unfortunate as the name should have no semantic meaning according to the spec. I think we should strive to not add more.

In r325686 another use of the name was added to handle the case when IRMover is given a non empty module and that module has multiple isomorphic types.. That can happens as only the IRMover merges isomorphic types. The clang output, for example, can have duplicated types.

This patch changes the IRMover to merge isomorphic types on the destination module.

I now think that this should probably be made into an optimization pass that is run by clang. That way the types are merged before the file is written.

This patch still needs comments and to have the refactoring bits split out.


https://reviews.llvm.org/D43595

Files:
  include/llvm/IR/GlobalValue.h
  include/llvm/IR/TypeFinder.h
  include/llvm/IR/ValueVisitor.h
  lib/IR/CMakeLists.txt
  lib/IR/TypeFinder.cpp
  lib/IR/ValueVisitor.cpp
  lib/Linker/IRMover.cpp
  test/Linker/Inputs/struct-mapping.ll
  test/Linker/struct-mapping.ll
  tools/llvm-link/llvm-link.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43595.135337.patch
Type: text/x-patch
Size: 13136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180221/88025d33/attachment.bin>


More information about the llvm-commits mailing list