Is "clang -O1" the same as "clang -O0 + opt -O1"?

Hello,

I encounter a bug that pumped during execution of “clang -O1”. However the bug cannot be reproduced by using “clang -O0 + opt -O1”. It seems that “clang -O1” is not the same as “clang -O0 + opt -O1”. According to the generated LLVM IRs are large, I would like to use bugpoint with “clang -O1” directly instead of using “clang -O0” first and using bugpoint with “opt -O1”. Could you tell me how I can do this?

Any suggestion is welcomed.

Thanks

Hi,

No, it's not. Try:
  clang -O1 -mllvm -disable-llvm-optzns -S -emit-llvm

to get the IR, as it would appear to the optimizer, but without running the optimizer itself as part of the clang invocation.

-Hal

Hello Hal,

Thansk for your reply. It seems that clang -O1 -mllvm -disable-llvm-optzns is the same as “clang -O0 -mllvm -disable-llvm-optzns”, right? Please tell me if I have mistake.

Although I use “clang -O0 -mllvm -disable-llvm-optzns + opt -O1”, the bug is still not reproduced. I use “mllvm -debug” to dump the pass manager’s arguments. It seems that the LLVM passes order is different between “clang -O0 -mllvm -disable-llvm-optzns + opt -O1” and “clang -O1”. The bug seems only occur when I am using “clang -O1”. Is there any way to use bugpoint with clang (embedded bugpoint into clang)?

Thanks a lot.