1; RUN: opt -dse -S < %s | FileCheck %s
2
3; Don't eliminate stores to allocas before tail calls to functions that use
4; byval. It's correct to mark calls like these as 'tail'. To implement this tail
5; call, the backend should copy the bytes from the alloca into the argument area
6; before clearing the stack.
7
8target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
9target triple = "i386-unknown-linux-gnu"
10
11declare void @g(i32* byval(i32) %p)
12
13define void @f(i32* byval(i32) %x) {
14entry:
15  %p = alloca i32
16  %v = load i32, i32* %x
17  store i32 %v, i32* %p
18  tail call void @g(i32* byval(i32) %p)
19  ret void
20}
21; CHECK-LABEL: define void @f(i32* byval(i32) %x)
22; CHECK:   store i32 %v, i32* %p
23; CHECK:   tail call void @g(i32* byval(i32) %p)
24