[llvm] [AggressiveInstCombine] Implement store merge optimization (PR #147540)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 17 12:33:22 PDT 2025
nikic wrote:
@dtcxzyw We always run these in the order `instcombine,aggressive-instcombine`, not `aggressive-instcombine,instcombine`. If instcombine runs first, then it will produce
```llvm
define void @src(ptr %0, ptr %.sroa.0.010) {
%2 = load i16, ptr %.sroa.0.010, align 2
%3 = getelementptr inbounds nuw i8, ptr %.sroa.0.010, i64 2
%4 = load i16, ptr %3, align 4
%5 = getelementptr inbounds nuw i8, ptr %0, i64 2
store i16 %2, ptr %5, align 2
%6 = getelementptr inbounds nuw i8, ptr %0, i64 4
store i16 %4, ptr %6, align 4
ret void
}
```
and then aggressive-instcombine will not change the IR.
https://github.com/llvm/llvm-project/pull/147540
More information about the llvm-commits
mailing list