Dear Mr. Roelofs,
Thank you so much for your answer.
I have a follow up question regarding the second question above.
What I try to do is actually to see the affects of individual optimizations on some benchmark applications. I used clang to convert the C code to LLVM IR:
clang -O0 -S -emit-llvm example_program.c -o unoptimized_example_program.ll
Later, I try to add individual optimizations with opt:
opt -S -passes=‘loop-unroll’ unoptimized_example_program.ll -o optimized_example_program.ll
However, unoptimized_example_program.ll and optimized_example_program.ll files are identical.
I have tried to add -disable-O0-optnone option to the clang command above as recommended here, but it changed nothing.
Then, I added pragmas as #pragma unroll as recommended here. It changed the resulting ll file. However, it does not print loop unroll when I compile it using the -Rpass=.* option. Hence, I assume it is not actually applied.
Later, I added additional optimizations (mem2reg,loop-simplify,loop-rotate) as written here but again, it changed nothing.
I have the same problem with other optimizations such as loop vectorization, enabling unsafe fp math and function inlining. What can I do to enforce an optimization? I see unrolling is applied to the code when I compile it with -O3 -Rpass=.* options.
Thanks in advance.