[InstCombine] Process blocks in RPO
InstComine currently processes blocks in an arbitrary depth-first order. This can break the usual invariant that the operands of an instruction should be simplified before the instruction itself, if uses across basic blocks (particularly inside phi nodes) are involved. This patch switches the initial worklist population to use RPO instead, which will ensure that predecessors are visited before successors (back-edges notwithstanding). This allows us to fold more cases within a single InstCombine iteration, in preparation for D154579. This change by itself is a minor compile-time regression of about 0.1%, which will be more than recovered by switching to single-iteration InstCombine. Differential Revision: https://reviews.llvm.org/D75362
Loading
Please sign in to comment