[llvm-commits] [patch] Add dominance computation for edges

Rafael EspĂ­ndola rafael.espindola at gmail.com
Sun Aug 5 17:20:11 PDT 2012


In LLVM the only value that is defined in an edge is the return value
of an invoke. There are cases however where a fact is true only   in
areas dominated by and edge. For example, in

define i32 @f(i32 %x) {
bb0:
  %cmp = icmp eq i32 %x, 0
  br i1 %cmp, label %bb2, label %bb1
bb1:
  br label %bb2
bb2:
  %cond = phi i32 [ %x, %bb0 ], [ 0, %bb1 ]
  %foo = add i32 %cond, %x
  ret i32 %foo
}

We can replace x with 0 in cond, but not in foo.

The attached patch refactors the code we have to handle invoke so that
it is available to clients that want to know if a use is dominated by
an edge.

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: edge.patch
Type: application/octet-stream
Size: 5521 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120805/4db25f06/attachment.obj>


More information about the llvm-commits mailing list