[llvm] [SROA] Prevent load atomic vector from being generated (PR #112432)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 6 09:47:39 PDT 2026
dtcxzyw wrote:
The following correctness issue was found by [llvm-hackme](https://github.com/dtcxzyw/llvm-hackme).
<!-- llvm-hackme-state: bug_found -->
<!-- llvm-hackme-baseline: 60cccae52fda78a9cdc9323900e14952d71b2624 -->
<!-- llvm-hackme-head-sha: e2e58ee18731db8cd3e10b3be69c6e88be23624b -->
<!-- llvm-hackme-patch-sha256: 100c910b142564ec33f48dbe29fb406167f481deb2f2104b3e3866bdff20ff95 -->
<!-- llvm-hackme-kind: crash -->
This comment is generated by an automated correctness checking service designed to help identify critical correctness bugs (opt crashes or Alive2 miscompilations) and improve PR review efficiency under limited reviewer bandwidth.
The reproducer was generated by LLM.
This bug is a regression introduced by this PR. It does not reproduce on the baseline commit.
## Reproducer
**Kind**: crash
**IR Reproducer**:
```llvm
; RUN: opt -passes=sroa -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 i32 @crash() {
%a = alloca <2 x i32>, align 8
store <2 x i32> <i32 1, i32 2>, ptr %a, align 8
%v = load atomic i32, ptr %a monotonic, align 4
ret i32 %v
}
```
**Stacktrace**:
```
opt: ../llvm-project-pr/llvm/lib/Transforms/Scalar/SROA.cpp:2812: bool {anonymous}::AllocaSliceRewriter::visit({anonymous}::AllocaSlices::const_iterator): Assertion `CanSROA' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /llvm-hackme/work/llvm-hackme/llvm-build-pr/bin/opt -S -o /dev/null /tmp/tmpzapd5_sh.ll -passes=sroa
1. Running pass "function(sroa<modify-cfg>)" on module "/tmp/tmpzapd5_sh.ll"
2. Running pass "sroa<modify-cfg>" on function "crash"
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 libLLVMSupport.so.23.0git 0x00007ffff7e177f2 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 66
1 libLLVMSupport.so.23.0git 0x00007ffff7e1449c llvm::sys::RunSignalHandlers() + 76
2 libLLVMSupport.so.23.0git 0x00007ffff7e146a1
3 libc.so.6 0x00007ffff7a19520
4 libc.so.6 0x00007ffff7a6d9fc pthread_kill + 300
5 libc.so.6 0x00007ffff7a19476 raise + 22
6 libc.so.6 0x00007ffff79ff7f3 abort + 211
7 libc.so.6 0x00007ffff79ff71b
8 libc.so.6 0x00007ffff7a10e96
9 libLLVMScalarOpts.so.23.0git 0x00007fffef950b4b
10 libLLVMScalarOpts.so.23.0git 0x00007fffef953697
11 libLLVMScalarOpts.so.23.0git 0x00007fffef955e81
12 libLLVMScalarOpts.so.23.0git 0x00007fffef9577c7
13 libLLVMScalarOpts.so.23.0git 0x00007fffef958675 llvm::SROAPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) + 565
14 libLLVMPasses.so.23.0git 0x00007ffff14fe9c6
15 libLLVMCore.so.23.0git 0x00007fffedf00f4d llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) + 429
16 libLLVMAMDGPUCodeGen.so.23.0git 0x00007ffff5aa9586
17 libLLVMCore.so.23.0git 0x00007fffedeff9f1 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) + 545
18 libLLVMOptDriver.so.23.0git 0x00007ffff7f84d96
19 libLLVMCore.so.23.0git 0x00007fffedf00017 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) + 359
20 libLLVMOptDriver.so.23.0git 0x00007ffff7f91a5b llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) + 4923
21 libLLVMOptDriver.so.23.0git 0x00007ffff7f9ee84 optMain + 12452
22 libc.so.6 0x00007ffff7a00d90
23 libc.so.6 0x00007ffff7a00e40 __libc_start_main + 128
24 opt 0x0000555555555095 _start + 37
```
**Baseline Revision**: `60cccae52fda78a9cdc9323900e14952d71b2624`
**PR Head SHA**: `e2e58ee18731db8cd3e10b3be69c6e88be23624b`
**Patch SHA256**: `100c910b142564ec33f48dbe29fb406167f481deb2f2104b3e3866bdff20ff95`
https://github.com/llvm/llvm-project/pull/112432
More information about the llvm-commits
mailing list