LLVM Code Generation on flattened IR code


I made two flattening transformation filters, one use a switch instruction for the dispatcher, and the other an indirectbranch instruction. Both work well but llc is very time consuming in the second case : 10 minutes for a 500 basic block function, while it takes 10 seconds for the switchcase implementation . The instrumentation of llc shows that most of the time is passed in the Machine Block Frequency Analysis pass

I don't understand why there is so huge difference. Is there a way to speed up llc ?

Charles Salmon

That’s a bug. Can you try with trunk and provide the LLVM IR test case? You can file a PR it at llvm.org/bugs.

There’s been some work on the block frequency algorithm recently, which is shared between LLVM IR and Machine IR, so it would be interesting to get that test case.


Thanks, i will do that
how can i attach a LLVM IR source file to a bug report?


----- Mail original -----

Hi Charles,

Thanks, i will do that


how can i attach a LLVM IR source file to a bug report?

It looks like you do it *after* the bug is created with a basic
description etc. (There's an "Add an attachment" link in the normal
display page).




i don't have any problem anymore after switching from 3.4 to the trunk version
it seems it has fixed the issue.


This is great to hear. If you do find another issue with block
frequency, please CC me on the bug report.

The testcase might be interesting to look at regardless, if you're
willing to mail it. I don't have any clear examples of slowdowns in the
old algorithm, and I'd be interested to have a closer look at what's
going on with this one.

i entered bug #20410
finally :