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

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 24 08:12:38 PDT 2017


anna added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:914
+      // 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;
----------------
anna wrote:
> sanjoy wrote:
> > How about `ConstantArray` and `ConstantStruct`?
> yes, good point. We are currently miscompiling for those types as well (basically all constant aggregate types : struct, array, vector). I'll update the patch and add test cases for these types.
Actually, I take that back. We will not fail for those types. Langref states that the condition for select can only be a `i1` or `<n x i1>`, i.e. a boolean or a vector of booleans. Both struct and arrays are different types from vector types.

So, in effect, this miscompile will only effect vectors that are the select condition operand. 


https://reviews.llvm.org/D31189





More information about the llvm-commits mailing list