[llvm] [SLP] Vectorize full insertvalue buildvector sequences (PR #200274)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 19 11:06:41 PDT 2026
asmok-g wrote:
This is causing another crash: The crash occurs during the Machine Instruction Scheduler pass.
```
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"
%struct.barney = type { float, float }
%struct.spam = type { %struct.blam, %struct.eggs, %struct.barney.0, %struct.wombat }
%struct.blam = type { i32 }
%struct.eggs = type { i32 }
%struct.barney.0 = type { i32 }
%struct.wombat = type { i32 }
define <2 x float> @ham(ptr %arg, ptr %arg1) {
bb:
%alloca = alloca %struct.barney, align 4
%getelementptr = getelementptr i8, ptr %arg1, i64 4
%load = load float, ptr %arg, align 4
%load2 = load float, ptr %arg1, align 4
%fmul = fmul float %load, %load2
%load3 = load float, ptr inttoptr (i64 4 to ptr), align 4
%load4 = load float, ptr %getelementptr, align 4
%fmul5 = fmul float %load3, %load4
%fadd = fadd float %fmul, %fmul5
call void @baz(ptr %alloca, float %fadd, float 0.000000e+00)
%load6 = load <2 x float>, ptr %alloca, align 4
ret <2 x float> %load6
}
define void @baz(ptr %arg, float %arg1, float %arg2) {
bb:
store float %arg1, ptr %arg, align 4
%getelementptr = getelementptr i8, ptr %arg, i64 4
store float %arg2, ptr %getelementptr, align 4
ret void
}
define void @wibble(ptr %arg, i32 %arg1, i32 %arg2) {
bb:
store i32 %arg1, ptr %arg, align 4
%getelementptr = getelementptr i8, ptr %arg, i64 8
store i32 %arg2, ptr %getelementptr, align 4
ret void
}
define { i64, i64 } @bar(ptr %arg, ptr %arg1) {
bb:
%alloca = alloca %struct.spam, align 4
%alloca2 = alloca %struct.barney, align 4
%alloca3 = alloca %struct.barney, align 4
%load = load i32, ptr %arg1, align 4
%sitofp = sitofp i32 %load to float
call void @baz(ptr %alloca2, float %sitofp, float 0.000000e+00)
%getelementptr = getelementptr i8, ptr %arg1, i64 4
%load4 = load i32, ptr %getelementptr, align 4
%sitofp5 = sitofp i32 %load4 to float
call void @baz(ptr %alloca3, float 0.000000e+00, float %sitofp5)
%call = call <2 x float> @ham(ptr %arg, ptr %alloca2)
%extractelement = extractelement <2 x float> %call, i64 0
%call6 = call <2 x float> @ham(ptr %arg, ptr %alloca3)
%extractelement7 = extractelement <2 x float> %call6, i64 0
%fpext = fpext float %extractelement7 to double
%call8 = call i32 @eggs(double %fpext)
%fpext9 = fpext float %extractelement to double
%call10 = call i32 @eggs(double %fpext9)
call void @wibble(ptr %alloca, i32 %call8, i32 %call10)
%load11 = load i64, ptr %alloca, align 4
%insertvalue = insertvalue { i64, i64 } poison, i64 %load11, 0
%getelementptr12 = getelementptr i8, ptr %alloca, i64 8
%load13 = load i64, ptr %getelementptr12, align 4
%insertvalue14 = insertvalue { i64, i64 } %insertvalue, i64 %load13, 1
ret { i64, i64 } %insertvalue14
}
define i32 @eggs(double %arg) {
bb:
%bitcast = bitcast double %arg to i64
%trunc = trunc i64 %bitcast to i32
ret i32 %trunc
}
; uselistorder directives
uselistorder ptr @eggs, { 1, 0 }
```
cmd:
```
clang \
-fno-omit-frame-pointer \
-no-canonical-prefixes \
-O2 \
--target=x86_64-unknown-linux-gnu \
-fsanitize=undefined,nullability \
-fno-sanitize-trap=all \
-fno-sanitize-recover=all \
-c -o /dev/null \
reduced.ll
```
Note: The sanitizer flags -fsanitize=undefined,nullability and optimization -O2 are critical to trigger the crash in the Machine Instruction Scheduler pass. Without them, the compiler may crash in a different pass or succeed
https://github.com/llvm/llvm-project/pull/200274
More information about the llvm-commits
mailing list