Skip to content

Commit

Permalink
[InstCombine] add code comment for icmp transform; NFC
Browse files Browse the repository at this point in the history
This was accidentally left out of cc88445
  • Loading branch information
rotateright committed Jul 1, 2022
1 parent ac8dab8 commit ab372cd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
Expand Up @@ -1551,6 +1551,8 @@ Instruction *InstCombinerImpl::foldICmpTruncConstant(ICmpInst &Cmp,
unsigned DstBits = Trunc->getType()->getScalarSizeInBits(),
SrcBits = X->getType()->getScalarSizeInBits();
if (Cmp.isEquality() && Trunc->hasOneUse()) {
// Canonicalize to a mask and wider compare if the wide type is suitable:
// (trunc X to i8) == C --> (X & 0xff) == (zext C)
if (!X->getType()->isVectorTy() && shouldChangeType(DstBits, SrcBits)) {
Constant *Mask = ConstantInt::get(X->getType(),
APInt::getLowBitsSet(SrcBits, DstBits));
Expand Down

0 comments on commit ab372cd

Please sign in to comment.