[LLVMdev] Jump Theading/GVN bug - moving discussion to llvm-dev

Sanjoy Das sanjoy at playingwithpointers.com
Mon Feb 23 20:56:59 PST 2015


> Handling unreachable code is annoying. I agree. However, its important to
> characterize how annoying. Most code is not unreachable, and we're
> (obviously) fine just bailing on such crazy code paths. So in practice the
> common cost is keeping a local set to detect cycles in the graph where we
> aren't expecting them. We are essentially always traversing a linked list
> representing this graph. Because these linked list nodes don't have any
> particular reason to have high locality, we have a cache-hostile traversal
> where we have to do primarily local and cache friendly book-keeping at each
> step to catch duplication. I suspect that this has a very small (but
> non-zero) impact on compile time.

Why not have an analysis pass that does a DFS starting from the entry
block?  Is that likely to be very costly?  Having an analysis pass is
attractive because that allows some transformation passes to put in
some extra work to preserve it if they so desire.

The analysis pass does not have to be clever at all, since the
verifier (rightly, I think) considers a block reachable even if it is
predicated on a literal false -- the following IR does not verify:

define void @f() {
 entry:
  br i1 false, label %t, label %f

 t:
  ret void

 f:
  %m = add i32 %m, 1
  ret void
}

-- Sanjoy



More information about the llvm-dev mailing list