
Following the previous patch which adds the "extend lifetimes" flag without (almost) any functionality, this patch adds the real feature by allowing Clang to emit fake uses. These are emitted as a new form of cleanup, set for variable addresses, which just emits a fake use intrinsic when the variable falls out of scope. The code for achieving this is simple, with most of the logic centered on determining whether to emit a fake use for a given address, and on ensuring that fake uses are ignored in a few cases. Co-authored-by: Stephen Tozer <stephen.tozer@sony.com>
19 lines
408 B
C
19 lines
408 B
C
// RUN: %clang_cc1 %s -emit-llvm -fextend-variable-liveness -o - | FileCheck %s
|
|
//
|
|
// Check we don't assert when there is no more code after a while statement
|
|
// and the body of the while statement ends in a return, i.e. no insertion point
|
|
// is available.
|
|
|
|
// CHECK: define{{.*}}foo
|
|
// CHECK: call{{.*}}llvm.fake.use
|
|
|
|
void foo() {
|
|
{
|
|
while (1) {
|
|
int ret;
|
|
if (1)
|
|
return;
|
|
}
|
|
}
|
|
}
|