[PATCH] D86306: [InstCombine] PHI-of-insertvalues -> insertvalue-of-PHI's

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 10:15:54 PDT 2020


lebedev.ri created this revision.
lebedev.ri added a reviewer: spatel.
lebedev.ri added a project: LLVM.
Herald added a subscriber: hiraditya.
lebedev.ri requested review of this revision.

As per statistic, this happens pretty exceedingly rare,
but i have seen it in exactly the situations the
Phi-aware aggregate reconstruction would have handled,
eventually, and allowed invoke -> call fold later on.

So while this might be something that other fold
will have to learn about, i wonder if we should be
doing this transform in general?

Here, we are okay with adding two PHI's to get both the base aggregate,
and the inserted value. I'm not sure it makes much sense to restrict
it to a single phi (to just the inserted value?), because originally
we'd be receiving the final aggregate already..

llvm test-suite + RawSpeed:

  | statistic name                             | baseline  | proposed  |    Δ |      % | \|%\| |
  |--------------------------------------------|-----------|-----------|-----:|-------:|------:|
  | instcombine.InsertValueOfPHIs              | 0         | 12        |  12  |  0.00% | 0.00% |
  | asm-printer.EmittedInsts                   | 8926643   | 8926595   | -48  |  0.00% | 0.00% |
  | instcombine.NumCombined                    | 3846614   | 3846640   |  26  |  0.00% | 0.00% |
  | instcombine.NumConstProp                   | 24302     | 24293     |  -9  | -0.04% | 0.04% |
  | instcombine.NumDeadInst                    | 1620140   | 1620112   | -28  |  0.00% | 0.00% |
  | instcount.NumBrInst                        | 898466    | 898464    |  -2  |  0.00% | 0.00% |
  | instcount.NumCallInst                      | 1760819   | 1760875   |  56  |  0.00% | 0.00% |
  | instcount.NumExtractValueInst              | 45659     | 45649     | -10  | -0.02% | 0.02% |
  | instcount.NumInsertValueInst               | 4991      | 4981      | -10  | -0.20% | 0.20% |
  | instcount.NumIntToPtrInst                  | 27084     | 27087     |   3  |  0.01% | 0.01% |
  | instcount.NumPHIInst                       | 371435    | 371429    |  -6  |  0.00% | 0.00% |
  | instcount.NumStoreInst                     | 906011    | 906019    |   8  |  0.00% | 0.00% |
  | instcount.TotalBlocks                      | 1105520   | 1105518   |  -2  |  0.00% | 0.00% |
  | instcount.TotalInsts                       | 9795737   | 9795776   |  39  |  0.00% | 0.00% |
  | simplifycfg.NumInvokes                     | 2784      | 2786      |   2  |  0.07% | 0.07% |
  | simplifycfg.NumSimpl                       | 1001840   | 1001850   |  10  |  0.00% | 0.00% |
  | simplifycfg.NumSinkCommonInstrs            | 15174     | 15170     |  -4  | -0.03% | 0.03% |


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86306

Files:
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
  llvm/test/Transforms/InstCombine/phi-aware-aggregate-reconstruction.ll
  llvm/test/Transforms/InstCombine/phi-of-insertvalues.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86306.286846.patch
Type: text/x-patch
Size: 8183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200820/1f87db0b/attachment.bin>


More information about the llvm-commits mailing list