]> granicus.if.org Git - llvm/commitdiff
[X86] SimplifyMultipleUseDemandedBits - target shuffles might not be identity
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 6 Aug 2019 12:41:29 +0000 (12:41 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 6 Aug 2019 12:41:29 +0000 (12:41 +0000)
If we don't demand any non-undef shuffle elements then the assert will fail as all shuffle inputs would still be flagged as 'identity' safe.

Exposed by an incoming patch.

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

lib/Target/X86/X86ISelLowering.cpp

index 66d4af11b50efaf361f5c42bae43c6f3669a0615..dc3ba714def641a0dd0bcb64ff0ab05cfc9e3633 100644 (file)
@@ -34758,12 +34758,13 @@ SDValue X86TargetLowering::SimplifyMultipleUseDemandedBitsForTargetNode(
         if (IdentityOp == 0)
           break;
       }
-      assert((IdentityOp == 0 || IdentityOp.countPopulation() == 1) &&
-             "Multiple identity shuffles detected");
 
       if (AllUndef)
         return DAG.getUNDEF(VT);
 
+      assert((IdentityOp == 0 || IdentityOp.countPopulation() == 1) &&
+             "Multiple identity shuffles detected");
+
       for (int i = 0; i != NumOps; ++i)
         if (IdentityOp[i])
           return DAG.getBitcast(VT, ShuffleOps[i]);