Skip to content

Commit

Permalink
fix typos; NFC
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253359 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rotateright committed Nov 17, 2015
1 parent 4158652 commit e6d768f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Transforms/InstCombine/InstCombineCasts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,15 +501,15 @@ Instruction *InstCombiner::visitTrunc(TruncInst &CI) {
// Transform trunc(lshr (sext A), Cst) to ashr A, Cst to eliminate type
// conversion.
// It works because bits coming from sign extension have the same value as
// sign bit of the original value; performing ashr instead of lshr
// the sign bit of the original value; performing ashr instead of lshr
// generates bits of the same value as the sign bit.
if (Src->hasOneUse() &&
match(Src, m_LShr(m_SExt(m_Value(A)), m_ConstantInt(Cst))) &&
cast<Instruction>(Src)->getOperand(0)->hasOneUse()) {
const unsigned ASize = A->getType()->getPrimitiveSizeInBits();
// This optimization can be only performed when zero bits generated by
// the original lshr aren't pulled into the value after truncation, so we
// can only shift by values smaller then the size of destination type (in
// can only shift by values smaller than the size of destination type (in
// bits).
if (Cst->getValue().ult(ASize)) {
Value *Shift = Builder->CreateAShr(A, Cst->getZExtValue());
Expand Down

0 comments on commit e6d768f

Please sign in to comment.