Commits

Chris Lattner committed 6a4e8989fc8
Teach CFGBuilder a simple peephole for tupleelement(tuple()) to just return the element of the tuple. This is a common case because CFGGen shouldn't (and doesn't) try to worry about this sort of thing. Before we'd get CFGIR like this: %15 = tuple (%4, %9, %14) %16 = alloc_array element type=Int, 3 %17 = tupleelement %16, 1 %18 = tupleelement %15, 0 %19 = store %18 -> %17 [initialization] %20 = index_lvalue %17, 1 %21 = tupleelement %15, 1 %22 = store %21 -> %20 [initialization] %23 = index_lvalue %17, 2 %24 = tupleelement %15, 2 %25 = store %24 -> %23 [initialization] now we get a dead tuple (%15), but much cleaner IR: %15 = tuple (%4, %9, %14) %16 = alloc_array element type=Int, 3 %17 = tupleelement %16, 1 %18 = store %4 -> %17 [initialization] %19 = index_lvalue %17, 1 %20 = store %9 -> %19 [initialization] %21 = index_lvalue %17, 2 %22 = store %14 -> %21 [initialization] Swift SVN r2994