[llvm-dev] Not to consolidate two structs with the same data types (but different names) in configure/make tool chain
Peng Yu via llvm-dev
llvm-dev at lists.llvm.org
Wed Feb 6 05:39:22 PST 2019
Hi,
I have the following C code.
#define PTR_T char *
typedef struct objcache {
PTR_T data;
int cs; /* cache size, number of objects */
int nc; /* number of cache entries */
} sh_obj_cache_t;
struct dstack {
char *delimiters;
int delimiter_depth;
int delimiter_space;
};
When it is configured/made to generate IR with the following
environment variables,
CC=clang CXX=clang++ RANLIB=llvm-ranlib CFLAGS=-flto LDFLAGS=-flto\
-fuse-ld=gold\ -Wl\,-plugin-opt=save-temps
I see all the variables declared as sh_obj_cache_t in the source code
becomes of type %struct.dstack instead of %struct.objcache.
sh_obj_cache_t wdcache = {0, 0, 0};
@wdcache = dso_local global %struct.dstack zeroinitializer, align 8, !dbg !1189
If I directly compile the .c file to .ll, I will not see this problem.
Is there a way to still use the configure/make toolchain, yet still
maintain the original type information instead of consolidating types
of the same data? Thanks.
--
Regards,
Peng
More information about the llvm-dev
mailing list