[clang] [llvm] [InstCombine] Support folding intrinsics into phis (PR #151115)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 1 01:51:09 PDT 2025


nikic wrote:

Reduced:
```llvm
define i32 @test(i1 %c, i32 %arg) {
entry:
  br i1 %c, label %if, label %if.end

if:
  %add = add i32 %arg, -8
  br label %if.end

if.end:
  %phi = phi i32 [ %add, %if ], [ 0, %entry ]
  %fshl1 = call i32 @llvm.fshl.i32(i32 %phi, i32 %phi, i32 29)
  %fshl2 = call i32 @llvm.fshl.i32(i32 %phi, i32 %phi, i32 29)
  %add2 = add i32 %fshl1, %fshl2
  ret i32 %add2
}
```

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


More information about the llvm-commits mailing list