Two questions on type based alias analysis in c

Dear cfe-dev and llvmdev,

I was doing some preliminary surveys on the type based alias analysis in C with LLVM toolchains, but encountered some problems.

(1) Can we get tbaa metadata in LLVM IR without modifying cfe or adding other optimizations during IR?

In my previous experiments, I fail to find a way to generate these metadata by invoking clang driver at O0 optimization level.
Specially, I found the thread titled “strict aliasing in LLVM”(!topic/llvm-dev/mjDAf8a_LdI) tells that using “-mllvm -enable-tbaa” might work. However when I use this command below, still no tbaa metada area is found in LLVM IR.

clang -O0 -fstrict-aliasing -Wstrict-aliasing my-example.c -emit-llvm -S -mllvm -enable-tbaa

And I somewhat suspect that -mllvm -enable-tbaa is even not necessary since I found that “enable-tbaa” seems to be on by default: with

clang -xc /dev/null -c -mllvm -print-all-options | grep tbaa

It prints:

-combiner-use-tbaa = 1 (default: 1)
-enable-tbaa = 1 (default: 1)
-use-tbaa-in-sched-mi = 1 (default: 1)

In the meantime, with optimization O1(or higher levels) it’s possible to get these metadata. The problem is that I cannot get the similar not-alias result for this case below(taken from Page 29 of the slides: if the x is local to a function, as the temp pointer variable would be optimized out during “-O1” compilation.

int x;
*(float *)&x = 2.3f;
x = 4;

(2) Are there large celeberated programs that is known to be compatible with ANSI C strict aliasing rule( )?
From the answer on stackoverflow( I guess that I have to find those candidates from a post-c99 codebase that does not involve device or messaging sending programs. Any suggestions?