[PATCH] D44102: Teach CorrelatedValuePropagation to reduce the width of udiv/urem instructions.

Justin Lebar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 7 07:15:04 PST 2018


jlebar added a comment.

Thank you for the reviews, Sanjoy and Sanjay!

I had a brief moment of terror when I realized that `(R.getUnsignedMax() + 1).ceilLog2()` can overflow.  It actually works, because 0.ceilLog2() returns num_bits.  But anyway I realized that there's getActiveBits(), which is what I actually wanted.

Submitting...



================
Comment at: llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp:438
+/// sufficient to contain its operands.
+static bool processUDivOrURem(BinaryOperator *SDI, LazyValueInfo *LVI) {
+  assert(SDI->getOpcode() == Instruction::UDiv ||
----------------
sanjoy wrote:
> Not sure what `SDI` stands for here -- how about just calling it `Inst`?
And here I just thought I was thick for not figuring it out.  :)  Changed.


Repository:
  rL LLVM

https://reviews.llvm.org/D44102





More information about the llvm-commits mailing list