[PATCH] D31189: [InstCombine] Fix folding of select into phi nodes when incoming element of phi is a vector type

David Majnemer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 08:46:18 PDT 2017


majnemer added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:911-912
       Constant *InC = dyn_cast<Constant>(PN->getIncomingValue(i));
-      if (InC && !isa<ConstantExpr>(InC))
+      // For vector constants, we cannot use isNullValue to fold into
+      // FalseVInPred versus TrueVInPred. It does not investigate the `nullness`
+      // of individual elements in the vector (and will always return false).
+      if (InC && !isa<ConstantExpr>(InC) && !isa<VectorType>(InC->getType()))
         InV = InC->isNullValue() ? FalseVInPred : TrueVInPred;
       else
----------------
I am surprised, what is InC if not a ConstantAggregateZero in this case?


https://reviews.llvm.org/D31189





More information about the llvm-commits mailing list