[LLVMdev] Irreducible CFG from tail duplication

Mark Leone markleone at gmail.com
Thu Jul 24 14:00:03 PDT 2008


It seems that tail duplication can make a reducible CFG irreducible
(example below).  Is that intentional?  Are there other optimizations
that have that property?

Is irreducibility a problem for existing LLVM passes?  It looks like
there was once an open project for a pass to make irreducible graphs
reducible.  Was that ever implemented?

- Mark


; "opt -inline -tailduplicate" makes an irreducible CFG from this code

@x = weak global float 0.0

define internal fastcc void @foo(float %f) {
entry:
	%b = fcmp ogt float %f, 0.0
	br i1 %b, label %then, label %continue
then:		
	store float 0.0, float* @x
	br label %continue
continue:		
	ret void
}

define void @test() {
entry:
	%x = load float* @x		
	call fastcc void @foo( float %x )
	%neg = sub float 0.0, %x
	call fastcc void @foo( float %neg )
	ret void
}



More information about the llvm-dev mailing list