Issue 64721
Summary [SROA] LLVM ERROR on atomic memory access
Labels new issue
Assignees
Reporter ericliuu
    The following IR crashes with an LLVM ERROR when being optimized by the SROAPass:

```llvm
define i32 @foo() {
  %A = alloca i1, align 1
  %1 = load atomic volatile i32, ptr %A seq_cst, align 4
  ret i32 %1
}
```

Here is the before and after from the SROAPass that causes the LLVM ERROR:
```llvm
*** IR Dump Before SROAPass on foo ***
define i32 @foo() {
  %A = alloca i1, align 1
  %1 = load atomic volatile i32, ptr %A seq_cst, align 4
  ret i32 %1
}
*** IR Dump After SROAPass on foo ***
define i32 @foo() {
 %A = alloca i1, align 1
  %A.0. = load atomic volatile i1, ptr %A seq_cst, align 4
  %A.0.load.ext = zext i1 %A.0. to i32
  ret i32 %A.0.load.ext
}
atomic memory access' size must be byte-sized
 i1 %A.0. = load atomic volatile i1, ptr %A seq_cst, align 4
LLVM ERROR: Broken function found, compilation aborted!
```

Here is the crash on godbolt: https://godbolt.org/z/3TYoYYYoq
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to