2

I need to visualize the CFG of an LLVM Function, which I have in a .ll file. There is the opt tool, which has the --view-cfg option. However, the problem is that the function is broken, the definition of a register does not dominate all its uses. I need to view the CFG to investigate why this is the case. Problem: opt does not take wrong LLVM functions, so I cannot view the CFG with it.

So, what is the best way to visualize the CFG of a broken LLVM function?

gexicide
  • 38,535
  • 21
  • 92
  • 152

1 Answers1

3

Problem: opt does not take wrong LLVM functions, so I cannot view the CFG with it.

That's not actually the case. The verifier is turned on by default, yes, but if the function in question is syntactically correct, then you can just turn it off:

$ opt -disable-verify -view-cfg foo.ll

Result of <code>opt -disable-verify -view-cfg</code>

You can even try to compile it with llc, run with lli, etc this way.

eush77
  • 3,870
  • 1
  • 23
  • 30