[llvm] [VectorCombine] foldShuffleOfBinops - fold shuffle(binop(shuffle(x),shuffle(z)),binop(shuffle(y),shuffle(w)) -> binop(shuffle(x,z),shuffle(y,w)) (PR #120984)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 30 18:38:09 PST 2024


dtcxzyw wrote:

Another reproducer extracted from pbrt-v4:
```
; bin/opt -passes=vector-combine test.ll -S
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define void @_ZNK4pbrt3SOAINS_10RaySamplesEEixEi(ptr nocapture %agg.result) {
entry:
  %0 = load ptr, ptr %agg.result, align 8
  %retval.sroa.0.0.copyload.i2 = load <2 x i32>, ptr %0, align 16
  %1 = extractelement <2 x i32> %retval.sroa.0.0.copyload.i2, i64 0
  %2 = extractelement <2 x i32> %retval.sroa.0.0.copyload.i2, i64 1
  store i32 %1, ptr %agg.result, align 4
  %agg.result.sroa_idx = getelementptr inbounds nuw i8, ptr %agg.result, i64 4
  store i32 %2, ptr %agg.result.sroa_idx, align 4
  ret void
}
```


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


More information about the llvm-commits mailing list