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

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 11:14:50 PST 2024


weiguozhi wrote:

> > IR diff looks good to me. I believe the regression can be addressed by using `simplifyInstruction` in `FoldOpIntoSelect`: https://alive2.llvm.org/ce/z/HiwgPk. We discussed about this in [#84686 (comment)](https://github.com/llvm/llvm-project/pull/84686#issuecomment-1987344128).
> 
> @weiguozhi Are you willing to try this?

Yes, I tried it. As you have noticed it doesn't handle non-const aggregates. We can enhance FoldOpIntoSelect to do the non-const transform in https://github.com/llvm/llvm-project/pull/100828/commits/aef54025298b496d4f0b8766816700659b2f9015

         extract (select (cond, insert(agg, elem), FV))
     ->  select (cond, elem, extract(FV))


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


More information about the llvm-commits mailing list