[llvm] [SimplifyCFG] Avoid threading for loop headers (PR #151142)
Alexander Kornienko via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 26 11:59:24 PDT 2025
alexfh wrote:
@ArneStenkrona2 the test case is here: https://gcc.godbolt.org/z/fdfaEK5bx
```
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 { %struct.spam }
%struct.spam = type { [1 x %struct.blam] }
%struct.blam = type { %struct.eggs }
%struct.eggs = type { %struct.barney.0 }
%struct.barney.0 = type { <8 x double> }
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0
define ptr @wombat(ptr %arg) {
bb:
%alloca = alloca %struct.barney, align 64
%alloca1 = alloca %struct.barney, align 64
%alloca2 = alloca %struct.barney, align 64
store volatile i32 0, ptr %alloca2, align 4
%call = call ptr @ham(ptr %alloca1, ptr %alloca2)
call void @llvm.memcpy.p0.p0.i64(ptr %alloca, ptr %alloca1, i64 64, i1 false)
%call3 = call ptr @baz(ptr %arg, ptr %alloca)
ret ptr %call3
}
define ptr @ham(ptr %arg, ptr %arg1) {
bb:
call void @wibble(ptr %arg, ptr %arg1)
ret ptr null
}
define ptr @baz(ptr %arg, ptr %arg1) {
bb:
call void @foo(ptr %arg, ptr %arg1)
ret ptr null
}
define void @wibble(ptr %arg, ptr %arg1) {
bb:
call void @bar(ptr %arg, ptr %arg1)
ret void
}
define void @bar(ptr %arg, ptr %arg1) {
bb:
%load = load <4 x double>, ptr %arg1, align 32
%fadd = fadd <4 x double> %load, zeroinitializer
%getelementptr = getelementptr i8, ptr %arg1, i64 32
store <4 x double> %fadd, ptr %getelementptr, align 32
call void @llvm.memcpy.p0.p0.i64(ptr %arg, ptr %arg1, i64 64, i1 false)
ret void
}
define <4 x double> @eggs(<4 x double> %arg) {
bb:
%fadd = fadd <4 x double> %arg, %arg
ret <4 x double> %fadd
}
define void @foo(ptr %arg, ptr %arg1) {
bb:
call void @widget(ptr %arg, ptr byval(%struct.eggs) %arg1) #1
ret void
}
define void @widget(ptr %arg, ptr %arg1) {
bb:
call void @hoge(ptr %arg, ptr byval(%struct.eggs) %arg1)
ret void
}
define void @hoge(ptr %arg, ptr %arg1) {
bb:
%load = load <4 x double>, ptr %arg1, align 64
%call = call <4 x double> @eggs(<4 x double> %load)
store <4 x double> %call, ptr %arg1, align 64
call void @llvm.memcpy.p0.p0.i64(ptr %arg, ptr %arg1, i64 64, i1 false)
ret void
}
attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { alwaysinline }
```
https://github.com/llvm/llvm-project/pull/151142
More information about the llvm-commits
mailing list