[PATCH] D83747: [argprom] Assessing impact of magic value MaxElements promoted on compiler performance

Shiva Badruswamy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 22:40:22 PDT 2020


teamiceberg created this revision.
teamiceberg added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

Our initial hypothesis is that changes to the magic value of (unsigned) MaxElements variable in ArgumentPromotion.cpp/ArgumentPromotion.h file can
lead to changes in compiler performance. To assess such changes, we have to introduce a global variable in the argumentpromotion.h header file. Then, we supply different values for this global variable by having a command line flag (-numargspromoted) bound to this global variable via the cl::opt interface. Initial analysis of compiler performance using the built in test suite demonstrate some significant changes in compile time as well as run time.
However, we are in the process of validating if these changes are real or just noise induced by other means. More experiments and sample runs need to be run, to be sure. However, we are setting up this initial patch as a way to learn how to setup a pipeline to enable the use of global variables to simulate magic values. Also, we are designing LIT tests to ensure that we submit a patch that conforms to built-in argument promotion tests in llvm/test folder.
Regression Test Setup: /llvm/test/Transforms/ArgumentPromotion has 2 tests: a) args-aggregates-mix-promote.ll; b)fourmember-struct-promote.ll to demonstrate that the flag works successfully.
Regression Test success criteria: For aggregate arguments, such as structs, by design only a maximum of 3 members are promoted. However by introducing a custom OPT flag, we can set this number to different values to promote any number of an aggregate's arguments. For instance, the regression test file "fourmember-struct-promote.ll" has a four member struct passed by reference to a simple function that sums the values of the members. The flag '-numargspromoted' value has to be 0 or 4 or higher for all the 4 struct members to be promoted. '0' defaults to 'always promote'. Supply a value less than 4 halts promotion. 
Given this flag, now we can test out the impact of the promotion on compile time and run time performance.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83747

Files:
  llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
  llvm/test/Transforms/ArgumentPromotion/args-aggregates-mix-promote.ll
  llvm/test/Transforms/ArgumentPromotion/fourmember-struct-promote.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83747.277673.patch
Type: text/x-patch
Size: 12354 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200714/eb4f9379/attachment.bin>


More information about the llvm-commits mailing list