What does the "ch" mean in LLVM DAG debug info?

When using -debug option with llc command, it will print the debug info of IR selection DAG Node like :

Optimized legalized selection DAG: %bb.0 'main:'
SelectionDAG has 14 nodes:
      t0: ch = EntryToken
    t4: ch = store<(store 4 into %ir.1)> t0, Constant:i32<0>, FrameIndex:i32<0>, undef:i32
  t7: ch = store<(store 4 into %ir.2)> t4, Constant:i32<1>, FrameIndex:i32<1>, undef:i32
      t8: i32,ch = load<(dereferenceable load 4 from %ir.2)> t7, FrameIndex:i32<1>, undef:i32
    t23: ch = br_cc t7, setlt:ch, t8, Constant:i32<1>, BasicBlock:ch< 0x59b93f8>
  t16: ch = br t23, BasicBlock:ch< 0x59b9338>

===== Instruction selection begins: %bb.0 ''

What exactly does the “ch” mean in that ? What’s its full name ?

The "ch" stands for chain. They are used to represent ordering of nodes as explained in the documentation.

As mentioned in the documentation, you can see that the type of “chain” edges is MVT::Other, and a quick grep through the code shows that "ch" is printed when the type is MVT::Other

The way I’ve always read this is that the lines with ch needs their ordering preserved at each level.

BTW, Its normally a lot easier to understand if you view the DAG in graphviz format using the -view-* options for dags here. Again as mentioned there, for large graphs, using the filter-view-dags allows with visualizing just the basic blocks of interest.

1 Like

ch stands for chain. Usually used to express ordering dependencies of side-effecting instructions.

1 Like

Thank you for reply !

Thank you very much !

Sidenote: I can’t be the only one who finds it quite annoying to see you post this same image in all of your questions from the past week. It takes up a lot of screen space and clutters your question unnecessarily; please don’t.


I’m very sorry for my inappropriate behavior, I won’t post any irrelevant image again

It’s not the image as such, but the size that is annoying. Something the size of a small icon or emoji would be fine.


Like this: :bowing_man: