Order of code generation

Hi!

I have a DAG (attached), which, according to me, should result in the
code for coroutine_make be generated _before_ the ret.

However, it seems that the corresponding EmitInstrWithCustomInserter is
being called /after/ the RET instruction has already been emitted.

The LLVM code I'm trying to compile is this (coroutine_make is an
intrinsic I've added):

declare i32 @llvm.coroutine_size()
declare void @llvm.coroutine_make(i64 *, i64 *, i8 *, i32)

define i64 * @foo() {
    %a = call i32 @llvm.coroutine_size()
    %b = alloca i64, i32 %a
    %func = bitcast i64* () * @foo to i64 *
    call void @llvm.coroutine_make(i64 * %b, i64 * %func, i8 * null, i32 20)
    ret i64 *%b
}

What am I doing wrong? How do I fix this?

Thanks!

dag.foo.dot.ps (30.1 KB)

Hi!

I have a DAG (attached), which, according to me, should result in the
code for coroutine_make be generated _before_ the ret.

However, it seems that the corresponding EmitInstrWithCustomInserter is
being called /after/ the RET instruction has already been emitted.

That is strange, from the dump it looks like all the chain edges are there.

What is the MI dump you get for this BB just after instruction selection?

Thanks!

Cheers,
Rafael

I need help with visualizing graphs before and after instruction selection.
The llc options listed in the docs do not work as specified.

-Omer

2011/8/8 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>

They do work if you have GraphViz binaries in your path when you configure LLVM.

Cameron

They do work if you have GraphViz binaries in your path when you configure LLVM.

I think you also need to build with assertions enabled.

Ciao, Duncan.

How do I enable the assertions when building ?
I am using 2.9, the current version, and when I use the standard build llc does not give me the view-*-dags options.

-Omer

How do I enable the assertions when building ?
I am using 2.9, the current version, and when I use the standard build llc does
not give me the view-*-dags options.

Configure with --enable-assertions

Ciao, Duncan.

After enabling assertions and recompilation I still get this error.

~/bin/llvm$ llc -view-isel-dags t3.bc
llc: Unknown command line argument ‘-view-isel-dags’. Try: ‘llc -help’
llc: Did you mean ‘-fast-isel-abort’?

and I see the view-edge bundles option but get the following error.

~/bin/llvm$ llc -view-edge-bundles t3.bc
Writing ‘/tmp/llvm_OrEAqH/EdgeBundles.dot’… done.
Running ‘dotty’ program… graph parser: syntax error near line 1
context: igraph >>> { <<<
dotty.lefty: cannot load graph

it pops up a window but does not display anything.

-Omer

Any ideas on how to resolve the issues related to graph viewing ?
I looked through the mailing list archives but did not find anything.

-Omer