xref: /llvm-project/llvm/test/Transforms/InstCombine/pr31990_wrong_memcpy.ll (revision 4ab40eca080965c65802710e39adbb78c4ce7bde)
1; RUN: opt -S -passes=instcombine %s -o - | FileCheck %s
2
3; Regression test of PR31990. A memcpy of one byte, copying 0xff, was
4; replaced with a single store of an i4 0xf.
5
6@g = constant i8 -1
7
8define void @foo() {
9entry:
10  %0 = alloca i8
11  call void @bar(ptr %0)
12  call void @llvm.memcpy.p0.p0.i32(ptr %0, ptr @g, i32 1, i1 false)
13  call void @gaz(ptr %0)
14  ret void
15}
16
17declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture readonly, i32, i1)
18declare void @bar(ptr)
19declare void @gaz(ptr)
20
21; The mempcy should be simplified to a single store of an i8, not i4
22; CHECK: store i8 -1
23; CHECK-NOT: store i4 -1
24