[PATCH] D157290: [InstCombine] Fold (-a >> b) and/or/xor (~a >> b) into (-a and/or/xor ~a) >> b

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 13 08:48:31 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:786
   auto GetInvShift = [](unsigned ShOpc) {
     return ShOpc == Instruction::LShr ? Instruction::Shl : Instruction::LShr;
   };
----------------
Can you add assert `ShOpc != Instruction::AShr` here. Your code is fine in that regard, but now that the match logic supports `AShr` but much of the existing logic doesn't think we should have a fail-loudly check incase someone updates in the future.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157290



More information about the llvm-commits mailing list