[PATCH] D22747: [InstCombine] try to fold (select C, (sext A), B) into logical ops

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 3 08:04:43 PDT 2016


spatel added a comment.

In https://reviews.llvm.org/D22747#504723, @nhaehnle wrote:

> I have just committed the tests baseline to trunk, this is the updated
>  patch.


Thanks!

Sorry I didn't notice this earlier, but can you reduce the first 8 tests by making them have i1 parameters instead of having icmp instructions in the tests?

Is there some reason we shouldn't do this transform for vector selects with splatted constants? If that's possible, it could actually simplify the patch by having foldSelectExtConst() take an APInt rather than a ConstantInt parameter with the caller code looking something like this:

  if (TI && (TI->getOpcode() == Instruction::ZExt || TI->getOpcode() == Instruction::SExt)) {
    const APInt *C;
    if (match(FalseVal, m_APInt(C))) {
      bool IsSext = TI->getOpcode() == Instruction::SExt;
      if (auto *Res = foldSelectExtConst(*Builder, SI, TI, C, true, IsSext))
        return Res;
    }
  }
  if (FI... )


https://reviews.llvm.org/D22747





More information about the llvm-commits mailing list