Regarding Usage of opt

Hi,

I am new to llvm, and recently am playing with opt. I want to use opt to apply one optimization pass to a .bc file. However, I encounter some problems which I failed to find the answers on the internet. Any suggestions are highly appreciated.

Question 1:

For example, I issued the following command

$: opt-trunk -si-lower-control-flow t.c_00.bc -o t.c_01.bc

Then I got the following error,

-------------------------------------------------------------- Error Start --------------------------------------------------------------

Pass ‘SI Lower control flow pseudo instructions’ is not initialized.

Verify if there is a pass dependency cycle.

Required Passes:

opt-trunk: /tmp/llvm-builder/llvm-source-trunk/lib/IR/LegacyPassManager.cpp:668: void llvm::PMTopLevelManager::schedulePass(llvm::Pass*): Assertion `PI && “Expected required passes to be initialized”’ failed.

-------------------------------------------------------------- Error End --------------------------------------------------------------

Question 2:

Some passes depend on other dependencies. Is there any convenient way to get the dependency for a specific pass?

Thank you and best regards,

Chengnian.

Hi,

I am new to llvm, and recently am playing with opt. I want to use opt to apply one optimization pass to a .bc file. However, I encounter some problems which I failed to find the answers on the internet. Any suggestions are highly appreciated.

Question 1:

For example, I issued the following command

$: opt-trunk -si-lower-control-flow t.c_00.bc -o t.c_01.bc

This pass is a machine function pass, it does not operates on the LLVM IR but on on MIs (machine instructions), i.e. after instruction selection. You cannot run it with opt and there is no easy way to run it in isolation.

Then I got the following error,

-------------------------------------------------------------- Error Start --------------------------------------------------------------

Pass ‘SI Lower control flow pseudo instructions’ is not initialized.

Verify if there is a pass dependency cycle.

Required Passes:

opt-trunk: /tmp/llvm-builder/llvm-source-trunk/lib/IR/LegacyPassManager.cpp:668: void llvm::PMTopLevelManager::schedulePass(llvm::Pass*): Assertion `PI && “Expected required passes to be initialized”’ failed.

-------------------------------------------------------------- Error End --------------------------------------------------------------

Question 2:

Some passes depend on other dependencies. Is there any convenient way to get the dependency for a specific pass?

Not than I know of (other than reading the source code, which is fortunately very easy: look for getAnalysisUsage())

The -debug-pass=structure option to opt will print out the passes that are run and in what order. From that output, you can generally determine which set of analysis passes are used by which set of optimizations. It can help narrow down which source code you need to examine. Regards, John Criswell

Thank you for your reply, John and Mehdi.It really helps.

Hi All,

I run into another problem with “opt-trunk -loop-data-prefetch”. The pass is in Transforms/Scalar/LoopDataPrefetch.cpp. How to avoid the following assertion failure, or I should just avoiding using this pass in isolation?

Thank you.

Hi,

Mehdi.

Thank you so much for the pointer.