[PATCH] D76941: [Module] Track intrinsic IDs in module to skip unnecessary lowering.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 27 11:28:39 PDT 2020


fhahn created this revision.
fhahn added a reviewer: efriedma.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

There are various intrinsic lowering passes and they currently all
require iterating over the whole function, even if there are no calls to
the intrinsics they are interested in.

This patch extends Module with a way to query if an intrinsic ID has any
declarations in the module. This can be used as a relatively cheap proxy
to bail out early from a lowering pass.

It adds a new optional map IntrinsicsInModule to Module and an
containsIntrinsicDeclaration helper. IntrinsicsInModule is initialized
the first time containsIntrinsicDeclaration is called and
getOrInsertFunction & Function::eraseFromParent() are updated to
update the map.

One thing that should probably be added as well is a way for lowering
pass to ensure they do not miss an intrinsic check if the add support
for new intrinsics.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76941

Files:
  llvm/include/llvm/IR/Module.h
  llvm/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp
  llvm/lib/IR/Function.cpp
  llvm/lib/IR/Module.cpp
  llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp
  llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76941.253177.patch
Type: text/x-patch
Size: 6230 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200327/95c993aa/attachment.bin>


More information about the llvm-commits mailing list