single exit BB

Hello. I'm new to LLVM, so I apologize if this is a basic question.

I've used llvm-gcc to produce an LLVM assembly file (-S) as well as
the bytecode file. I then used 'analyze -print-cfg' on the bytecode
and realized that some optimizations have been applied against the
corresponding assembly file. If I understand the operations, the
emitted assembly file has no optimizations, and hence functions
always start with a single exit BB.

My question is, how can I disable the optimizations (during assembly
and link phases) such that the bytecode file will be the same as the
assembly file? In particular, if I can preserve the function's single
exit BB, that would be nice. Thanks!

I've used llvm-gcc to produce an LLVM assembly file (-S) as well as
the bytecode file. I then used 'analyze -print-cfg' on the bytecode
and realized that some optimizations have been applied against the
corresponding assembly file. If I understand the operations, the
emitted assembly file has no optimizations, and hence functions
always start with a single exit BB.

My question is, how can I disable the optimizations (during assembly
and link phases) such that the bytecode file will be the same as the
assembly file? In particular, if I can preserve the function's single
exit BB, that would be nice. Thanks!

I think what you want is this:
http://llvm.org/docs/FAQ.html#cfe

"How can I disable all optimizations when compiling code using the LLVM GCC front end?

Passing "-Wa,-disable-opt -Wl,-disable-opt" will disable *all* cleanup and optimizations done at the llvm level, leaving you with the truly horrible code that you desire."

If that doesn't solve your problem let me know.

There is also some good documentation on llvmgcc:
http://llvm.org/docs/CommandGuide/html/llvmgcc.html

-Tanya