• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -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  %1 = bitcast i8* %0 to i4*
12  call void @bar(i4* %1)
13  %2 = bitcast i4* %1 to i8*
14  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %2, i8* @g, i32 1, i1 false)
15  call void @gaz(i8* %2)
16  ret void
17}
18
19declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i1)
20declare void @bar(i4*)
21declare void @gaz(i8*)
22
23; The mempcy should be simplified to a single store of an i8, not i4
24; CHECK: store i8 -1
25; CHECK-NOT: store i4 -1
26