[llvm] [InstCombine] Extend folding of aggregate construction to cases when source aggregates are partially available (PR #100828)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 14:43:27 PDT 2024


nikic wrote:

Some quick thoughts:
 * Looking at https://github.com/dtcxzyw/llvm-opt-benchmark/pull/1288/files, a significant number of the transforms look non-profitable. This transforms is reasonable if it actually drops extractelement + insertelement pairs, but if you just move insertelements to a predecessor while converting scalar phis into aggregate phis, I think that's a loss, because optimizations generally have troubles with aggregate SSA values. I think this happens mostly if the other phi operands are constants.
 * BFI in InstCombine -- wat? It looks like it's currently only used in SLC. Let's not use it in InstCombine proper.
 * To protect against cycles you probably want to check isBackEdge() instead, which was recently added.
 * `succ_size(Pred) != 1` => This should probably explicitly check for an unconditional branch, so you don't need to deal with the weird edge cases? (Like say, a single-successor callbr with aggregate return).

https://github.com/llvm/llvm-project/pull/100828


More information about the llvm-commits mailing list