I have a bitcode file which I’m trying to analyze its compilation result.
seems like the switches that where used when the bitcode where generated are somehow fixed and cannot be override.
i.e. if it was compiled with -O3 and I pass any other optimization level besides -O0 the s file is identical.
what do I miss here?
is there a way to override it?
It’s not quite clear what commands you’re running to compile and reprocess the files. If you’re using
clang -O3 -emit-llvm then it will run the LLVM optimization pipeline before giving you the IR.
If you want to experiment with different levels in
opt then you should probably use
clang -O3 -emit-llvm -Xclang -disable-llvm-passes which skips actually running any ooptimizations. The
-O3 tells Clang not to mark all the functions
optnone which happens at the (default) -O0 and prevents
opt from doing anythning, and also to add other hints for optimization. Anything except
-O0 would do the same job there.
this is the command line I use:
clang++ --target= -std=c++11 -c -save-temps -Oz file.bc