[alias] how to pass option -print-alias-sets base on clang?

we can use opt -print-alias-sets, while it is fail with clang -mllvm -print-alias-sets,
so my question is how to use -print-alias-sets base on clang ?

I’m not sure but you can try:
clang -Xclang -print-alias-sets

Przemek

thanks, but unfortunately, it still failed. Compiler Explorer

In general, to pass llvm flags to clang:

clang ...  -mllvm -your-llvm-flag-a -mllvm -your-llvm-flag-b=foo

In this particular case, it seems like -print-alias-sets is a pass instead of a simple flag, so that won’t work.

cc: @alina and @jdoerfert for AA expertise

What is it that you’re trying to do? Do you want to see the alias information for a given input or do you want the state of the alias sets at a specific time when the alias set tracker is used?

If you just want to run the pass, I don’t think you can do it with clang.
One option is:
clang -c -emit-llvm [-disable-llvm-passes -disable-llvm-optzns] input.c -o input.bc
opt -print-alias-sets input.bc

@alina
Yes, I want to see the alias information, thanks! so option -print-alias-sets can’t be passed for clang directly?

No, because -print-alias-sets is a pass, not a flag. To see the alias sets, try the above instructions to run the pass with opt.
To get misc AA info for a debug build, you can add to clang -mllvm -aa-trace.