[PATCH] D42032: [LLVM][PASSES][InstCombine] Fix (a + a + ...) / a cases

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 11:37:27 PST 2018


spatel added a comment.

This patch raises a question that I don't know the answer to. We're missing the more general fold (divisor is not constant) in instcombine:

  Name: shl_div
  %a = shl nsw i8 %x, %y
  %r = sdiv i8 %a, %x
    =>
  %r = shl i8 1, %y

https://rise4fun.com/Alive/7l

You can't do that here in instsimplify because we don't create new instructions here.

Is it better to just add that to instcombine and forego adding the special-case with constant divisor to instsimplify?


https://reviews.llvm.org/D42032





More information about the llvm-commits mailing list