[PATCH] D24467: Fix an error after D21678

Vladimir Yakovlev via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 14 12:32:56 PDT 2016


vbyakovlcl added inline comments.

================
Comment at: llvm/tools/clang/lib/Sema/SemaExpr.cpp:8790
@@ -8774,3 +8789,3 @@
       S.Context.getExtVectorType(RHSEleType, LHSVecTy->getNumElements());
     RHS = S.ImpCastExprToType(RHS.get(), VecTy, CK_VectorSplat);
   }
----------------
ahatanak wrote:
> OK. So the rule is that the type of the scalar operand is normally converted to the vector element type of the other operand before being transformed to a vector, but we don't have to do this when it's used as the RHS (shift amount) because IRGen generates the correct IR without the conversion?
Yes. I think a CodeGen test should be added for checking of IR correctness. 

================
Comment at: llvm/tools/clang/test/Sema/vecshift.c:56
@@ +55,3 @@
+
+  vc4 = vc4 << vc8; // expected-error {{vector operands do not have the same number of elements}}
+  vi4 = vi4 << vuc8; // expected-error {{vector operands do not have the same number of elements}}
----------------
ahatanak wrote:
> I don't think this patch was necessary to have clang print diagnostic "vector operands do not have the same number of elements"? If that's the case, I think it's better to add these lines in a separate commit.
Do you propose to delete lines with this diagnostic?


https://reviews.llvm.org/D24467





More information about the cfe-commits mailing list