[PATCH] D146350: [InstCombine] More aggressively try and fold irem/idiv/mul into selects.

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 21 15:55:29 PDT 2023


goldstein.w.n added a comment.

In D146350#4359337 <https://reviews.llvm.org/D146350#4359337>, @nikic wrote:

> I think this is basically okay if you drop the mul handling. As @xbolva00 pointed out (thanks, this is the bit I was missing here!) the mul case is already handled by foldBinOpIntoSelectOrPhi() and you're duplicating the transform for a special case now. If we want to extend handling to more cases, we should do so generically inside foldBinOpIntoSelectOrPhi(), not by repeating the transform with different arguments.

Ah, I had misunderstood his comment. I can move all the logics for div/mul/rem/etc.. into `foldBinOpInstoSelectOrPhi`. We actually call it for udiv as well (with really weak speculative checks).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146350/new/

https://reviews.llvm.org/D146350



More information about the llvm-commits mailing list