[clang] [Clang] Add fake use emission to Clang with -fextend-lifetimes (PR #110102)
Jeremy Morse via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 19 07:29:26 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;
----------------
jmorse wrote:
Should we not be initializing these items -- for the volatile at least, there's no defined value for it at any point, so it'd hard to generate a fake use anyway.
https://github.com/llvm/llvm-project/pull/110102
More information about the cfe-commits
mailing list