[PATCH] D35044: [IR] Remove the opcode argument from CmpInst::Create

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 9 06:14:12 PDT 2017


craig.topper added a comment.

I think part of another change snuck into this patch. Particularly the stuff in InstCombineSelect.cpp. So ignore that.

I originally noticed this while playing around with removing the one use restriction from this code in visitXor

  // not (cmp A, B) = !cmp A, B
  CmpInst::Predicate Pred;
  if (match(&I, m_Not(m_OneUse(m_Cmp(Pred, m_Value(), m_Value()))))) {
    cast<CmpInst>(Op0)->setPredicate(CmpInst::getInversePredicate(Pred));
    return replaceInstUsesWith(I, Op0);
  }

This requires creating a new instruction and we should be able to use CmpInst::Create, but the m_Cmp matcher only returns the Predicate. So we have to examine the predicate to get the correct opcode.


https://reviews.llvm.org/D35044





More information about the llvm-commits mailing list