]> granicus.if.org Git - llvm/commitdiff
[InstCombine] Speculatively implement a fix for what might be the root cause of PR337...
authorCraig Topper <craig.topper@intel.com>
Sun, 9 Jul 2017 03:25:17 +0000 (03:25 +0000)
committerCraig Topper <craig.topper@intel.com>
Sun, 9 Jul 2017 03:25:17 +0000 (03:25 +0000)
I recently changed m_One and m_AllOnes to use Constant::isOneValue/isAllOnesValue which work on floating point values too. The original implementation looked specifically for ConstantInt scalars and splats. So I'm guessing we are accidentally trying to issue sext/zexts on floating point types now.

Hopefully I figure out how to reproduce the failure from the PR soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307486 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineSelect.cpp

index 00564f1db96dd50fe752a6b6eb43b0fe4a1df016..75100676453535afbe4188cbb2db559a8c7bf1f2 100644 (file)
@@ -1223,7 +1223,8 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
   // select i1 %c, <2 x i8> <1, 1>, <2 x i8> <0, 0>
   // because that may need 3 instructions to splat the condition value:
   // extend, insertelement, shufflevector.
-  if (CondVal->getType()->isVectorTy() == SelType->isVectorTy()) {
+  if (SelType->isIntOrIntVectorTy() &&
+      CondVal->getType()->isVectorTy() == SelType->isVectorTy()) {
     // select C, 1, 0 -> zext C to int
     if (match(TrueVal, m_One()) && match(FalseVal, m_Zero()))
       return new ZExtInst(CondVal, SelType);