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

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 10:35:21 PDT 2024


dtcxzyw wrote:

> The test case is extracted from hot path of tcmalloc, so it has real world impact.
> 
> This patch uses LoopInfo, so you need to run it with
> 
> ```
> bin/opt -passes='instcombine<use-loop-info>' reduced.ll
> ```
> 
> I ran the patch on your smaller test case, and got
> 
> ```
> opt -passes='instcombine<use-loop-info>' reduced2.ll -S
> 
> define hidden { i64, i64 } @"_ZN4core6result19Result$LT$T$C$E$GT$7map_err17h84015741f1851E.llvm"(i64 noundef %0, i64 %1) unnamed_addr {
>   %3 = insertvalue { i64, i64 } poison, i64 %0, 0
>   %4 = insertvalue { i64, i64 } %3, i64 %1, 1
>   ret { i64, i64 } %4
> }
> ```
> 
> How did you run it?

I run it with `opt -O3`. `UseLoopInfo` is disabled by default due to compilation time regression: https://github.com/llvm/llvm-project/commit/ef6f23535d4e2b437913b48bdbdef00f000594c2


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


More information about the llvm-commits mailing list