[clang] [Clang] Add fake use emission to Clang with -fextend-lifetimes (PR #110102)
Stephen Tozer via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 27 06:18:09 PST 2024
================
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 %s -O2 -emit-llvm -fextend-lifetimes -o - | FileCheck %s
+// Make sure we don't generate fake.use for non-scalar variables.
+// Make sure we don't generate fake.use for volatile variables
+// and parameters even when they are scalar.
+
+struct A {
+ unsigned long t;
+ char c[1024];
+ unsigned char r[32];
+};
+
+
+int foo(volatile int param)
+{
+ struct A s;
+ volatile int vloc;
+ struct A v[128];
+ char c[33];
+ return 0;
----------------
SLTozer wrote:
We don't need initialization to generate fake uses - adding some positive tests should give assurance within the test itself that initializing is unnecessary.
https://github.com/llvm/llvm-project/pull/110102
More information about the cfe-commits
mailing list