llvm / llvm/llvm-project

[GVN] Missing store to load forwarding for memset.pattern

Open
#176,655 2 comments 0 reactions 0 assignees View on GitHub
llvm:optimizations missed-optimization
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

https://llvm.godbolt.org/z/GzehrjsxW
```llvm
define <8 x i32> @test_pattern(ptr %p) {
call void @llvm.experimental.memset.pattern.p0.i32.i64(ptr %p, i32 42, i64 8, i1 false)
%load = load <8 x i32>, ptr %p
ret <8 x i32> %load
}

define <8 x i32> @test_plain(ptr %p) {
call void @llvm.memset.pattern.p0.i64(ptr %p, i8 42, i64 32, i1 false)
%load = load <8 x i32>, ptr %p
ret <8 x i32> %load
}
```
The latter case forwards, the former does not.

Contributor guide

Open the contributing guide

Research direction

Start with the linked LLVM Godbolt reproducer and compare the generated results for test_pattern and test_plain. Trace the store-to-load forwarding path for the two memset pattern intrinsics; done means the experimental memset.pattern case forwards the loaded vector consistently with the plain case.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.