[PATCH] [InstCombine] Constant comparison involving "lshr exact"

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Mon Jun 2 06:36:09 PDT 2014


There is still quiet a bit of duplicated code. For example

 shift = Quotient.logBase2();
 return new ICmpInst(I.getPredicate(), A,
                         ConstantInt::get(A->getType(), shift));
                          ConstantInt::get(A->getType(), shift));


With a helper function it looks like you can return a boolean for "found optimization opportunity" and set the Quotient variable. That way the shif and the construction of the ICmpInst are shared.

http://reviews.llvm.org/D3987






More information about the llvm-commits mailing list