| Issue |
163455
|
| Summary |
[MemCpyOpt] Slot optimization miscompilation
|
| Labels |
miscompilation
|
| Assignees |
|
| Reporter |
tmiasko
|
Running `opt --passes=memcpyopt` on
```llvm
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 void @f(ptr dead_on_unwind noalias noundef writable dereferenceable(80) %a) {
start:
%b = alloca [80 x i8]
call void @g(ptr %b)
call void @llvm.memcpy.p0.p0.i64(ptr %a, ptr %b, i64 80, i1 false)
ret void
}
declare void @g(ptr)
```
results in
```llvm
define void @f(ptr dead_on_unwind noalias noundef writable dereferenceable(80) %a) {
start:
%b = alloca [80 x i8], align 1
call void @g(ptr %a)
ret void
}
```
In the resulting program, pointer passed to `g` can be incorrectly observed to equal `%a`, even though it was impossible originally.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs