[PATCH] D37355: Add CalledValuePropagation pass
Matthew Simpson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 31 14:10:02 PDT 2017
mssimpso created this revision.
Herald added subscribers: eraman, mgorny, mehdi_amini.
Herald added a reviewer: deadalnix.
This patch adds a new transformation for propagating values used for indirect calls. The idea for this pass came from the review of https://reviews.llvm.org/D36432. The pass performs an IPSCCP-like analysis, propagating functions to indirect call sites and then attaching metadata to the call sites indicating the set of functions they may potentially target at run-time.
This metadata may be consumed by later transformations. My initial plan is to use the metadata to perform indirect call promotion for call sites that are known to target only two functions. The metadata can also be used, for example, to allow call sites to intersect the function attributes of the functions they are known to target (i.e., in CallSiteBase::hasFnAttr).
Although I've implemented this as a separate pass, the functionality could be added to IPSCCP without too much effort. I chose a separate pass primarily as an opportunity to revive the unused generic sparse propagation solver, but this isn't strictly necessary.
If patch sounds reasonable, please take a look at the dependent patches as well. https://reviews.llvm.org/D37354 adds the new kind of metadata, and https://reviews.llvm.org/D37353 enables the generic sparse propagation solver to work interprocedurally similar to IPSCCP. I've added a simple demonstration test to this patch, but I will add more if the overall approach looks good.
https://reviews.llvm.org/D37355
Files:
include/llvm-c/Transforms/IPO.h
include/llvm/InitializePasses.h
include/llvm/LinkAllPasses.h
include/llvm/Transforms/IPO.h
include/llvm/Transforms/IPO/CalledValuePropagation.h
lib/Passes/PassBuilder.cpp
lib/Passes/PassRegistry.def
lib/Transforms/IPO/CMakeLists.txt
lib/Transforms/IPO/CalledValuePropagation.cpp
lib/Transforms/IPO/IPO.cpp
lib/Transforms/IPO/PassManagerBuilder.cpp
test/Other/new-pm-defaults.ll
test/Other/new-pm-lto-defaults.ll
test/Other/new-pm-thinlto-defaults.ll
test/Transforms/CalledValuePropagation/simple.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37355.113465.patch
Type: text/x-patch
Size: 28854 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170831/ab1a428c/attachment.bin>
More information about the llvm-commits
mailing list