mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-19 11:56:42 +00:00

Set the writable and dead_on_unwind attributes for sret arguments. These indicate that the argument points to writable memory (and it's legal to introduce spurious writes to it on entry to the function) and that the argument memory will not be used if the call unwinds. This enables additional MemCpyOpt/DSE/LICM optimizations.
22 lines
524 B
C++
22 lines
524 B
C++
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=ppc64-windows-msvc | FileCheck %s
|
|
|
|
// The purpose of this test is to see that we do something reasonable for
|
|
// architectures where we haven't checked what MSVC does.
|
|
|
|
struct A {
|
|
A() : a(42) {}
|
|
A(const A &o) : a(o.a) {}
|
|
~A() {}
|
|
int a;
|
|
};
|
|
|
|
struct B {
|
|
A foo(A o);
|
|
};
|
|
|
|
A B::foo(A x) {
|
|
return x;
|
|
}
|
|
|
|
// CHECK-LABEL: define{{.*}} void @"?foo@B@@QEAA?AUA@@U2@@Z"(ptr {{[^,]*}} %this, ptr dead_on_unwind noalias writable sret(%struct.A) align 4 %agg.result, ptr noundef %x)
|