[PATCH] D21315: Reorder SimplifyCFG and SROA?

Thomas Jablin via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 10:33:24 PDT 2016

tjablin added a comment.

Hi Chandler,
The FoldValueComparisonIntoPredecessors logic already mostly understands the code pattern produced by FoldingBranchToCommonDest, but would need to duplicate most of the logic from Early-CSE to get the rest of the way there. The current pass order is: CFGSimplification, SROA, EarlyCSE. If either EarlyCSE or SROA runs before SimplifyCFG there's no problem. Alternatively, a second pass through SimplifyCFG will also generate good code as long as it is before InstCombine. InstCombine is problematic since it "strength reduces" some equality comparisons to bitwise operations. For example:

  (i == 5334 || i == 5335)


  ((i | 1) == 5335)


More information about the llvm-commits mailing list