swift
93a0dfc5 - SILOptimizer: a new small optimization pass to remove redundant basic block arguments.

Commit
5 years ago
SILOptimizer: a new small optimization pass to remove redundant basic block arguments. 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
Author
Committer
Parents
Loading