mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 03:26:06 +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.
21 lines
444 B
C++
21 lines
444 B
C++
// RUN: %clang_cc1 %s -triple=arm-unknown-linux-gnueabi -target-abi aapcs -emit-llvm -o - | FileCheck %s
|
|
|
|
class SMLoc {
|
|
const char *Ptr;
|
|
public:
|
|
SMLoc();
|
|
SMLoc(const SMLoc &RHS);
|
|
};
|
|
SMLoc foo(void *p);
|
|
void bar(void *x) {
|
|
foo(x);
|
|
}
|
|
void zed(SMLoc x);
|
|
void baz() {
|
|
SMLoc a;
|
|
zed(a);
|
|
}
|
|
|
|
// CHECK: declare void @_Z3fooPv(ptr dead_on_unwind writable sret(%class.SMLoc) align 4, ptr noundef)
|
|
// CHECK: declare void @_Z3zed5SMLoc(ptr noundef)
|