[PATCH] D138360: [CVP] Eliminate urem when LHS < RHS

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 06:51:45 PST 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp:773
+  assert(Instr->getOpcode() == Instruction::URem);
+  if (Instr->getType()->isVectorTy())
+    return false;
----------------
Already checked in processUDivOrURem.


================
Comment at: llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp:780
+          .ult(LVI->getConstantRange(Instr->getOperand(1), Instr)
+                   .getUnsignedMin())) {
+    Instr->replaceAllUsesWith(Instr->getOperand(0));
----------------
I'd suggest writing this as `CR1.icmp(ICmpInst::ICMP_ULT, CR2)`.


================
Comment at: llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp:793
          Instr->getOpcode() == Instruction::URem);
   if (Instr->getType()->isVectorTy())
     return false;
----------------
Already checked in processUDivOrURem


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138360



More information about the llvm-commits mailing list