Search code examples
compiler-constructionllvmgraphvizdotllc

Dot file not genearting for -view-isel-dags option


While trying to see the SelectionDag nodes generated during the instruction selection phase using LLVM (built from sources with debug mode enabled), I am using the below command which is not creating Graphviz DOT file.

llc -view-isel-dags sum.bc

Instead it is creating sum.s file. Is there something I'm missing here?

sum.c

int sum(int x, int y) {
  return x+y;
}

sum.bc

$ clang -emit-llvm sum.c -c -o sum.bc

LLVM information

$ llc -help-hidden | grep 'view-isel' -view-isel-dags - Pop up a window to show isel dags as they are selected

$ llvm-config --build-mode
Debug

Solution

  • Guess the problem is with fast instruction selection which is enabled by default.

    $ llc -debug sum.ll

    Skipping pass 'X86 DAG->DAG Instruction Selection' on function sum

    Changing optimization level for Function sum Before: -O2 ; After: -O0

    FastISel is enabled

    Disabling fastIsel resolved this problem.

    $ llc -fast-isel=false -view-dag-combine1-dags sum.ll