The ComputeEffects pass derives escape information for function arguments and adds those effects in the function.
This needs a lot of changes in check-lines in the tests, because the effects are printed in SIL
The ComputeEffects pass derives escape information for function arguments and adds those effects in the function.
This needs a lot of changes in check-lines in the tests, because the effects are printed in SIL
RedundantPhiElimination eliminates block phi-arguments which have the same value as other arguments of the same block.
This also works with cycles, like two equivalent loop induction variables. Such patterns are generated e.g. when using stdlib's enumerated() on Array.
preheader:
br bb1(%initval, %initval)
header(%phi1, %phi2):
%next1 = builtin "add" (%phi1, %one)
%next2 = builtin "add" (%phi2, %one)
cond_br %loopcond, header(%next1, %next2), exit
exit:
is replaced with
preheader:
br bb1(%initval)
header(%phi1):
%next1 = builtin "add" (%phi1, %one)
%next2 = builtin "add" (%phi1, %one) // dead: will be cleaned-up later
cond_br %loopcond, header(%next1), exit
exit:
Any remaining dead or "trivially" equivalent instructions will then be cleaned-up by DCE and CSE, respectively.
rdar://problem/33438123
Convert sequences of
%payload_addr = init_enum_data_addr %enum_addr
%elem0_addr = tuple_element_addr %payload_addr, 0
%elem1_addr = tuple_element_addr %payload_addr, 1
...
store %payload0 to %elem0_addr
store %payload1 to %elem1_addr
...
inject_enum_addr %enum_addr, $EnumType.case
to
%tuple = tuple (%payload0, %payload1, ...)
%enum = enum $EnumType, $EnumType.case, %tuple
store %enum to %enum_addr
Such patterns are generated for example when using the stdlib enumarated() function.
Part of rdar://problem/33438123