the call to UsualArithmeticConversions should come after the call to CheckVectorOperands on CheckConditionalOperands function. This problem caused compilation error with test17 on "test/CodeGen/ext-vector.c".

llvm-svn: 189773
This commit is contained in:
Jin-Gu Kang 2013-09-02 20:32:37 +00:00
parent e7d746d8b9
commit 09c2213ce6
2 changed files with 19 additions and 8 deletions

View File

@ -5444,9 +5444,18 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS,
VK = VK_RValue;
OK = OK_Ordinary;
// First, check the condition.
Cond = UsualUnaryConversions(Cond.take());
if (Cond.isInvalid())
return QualType();
if (checkCondition(*this, Cond.get()))
return QualType();
// Now check the two expressions.
if (LHS.get()->getType()->isVectorType() ||
RHS.get()->getType()->isVectorType())
return CheckVectorOperands(LHS, RHS, QuestionLoc, /*isCompAssign*/false);
UsualArithmeticConversions(LHS, RHS);
if (LHS.isInvalid() || RHS.isInvalid())
return QualType();
@ -5455,14 +5464,6 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS,
QualType LHSTy = LHS.get()->getType();
QualType RHSTy = RHS.get()->getType();
// first, check the condition.
if (checkCondition(*this, Cond.get()))
return QualType();
// Now check the two expressions.
if (LHSTy->isVectorType() || RHSTy->isVectorType())
return CheckVectorOperands(LHS, RHS, QuestionLoc, /*isCompAssign*/false);
// If the condition is a vector, and both operands are scalar,
// attempt to implicity convert them to the vector type to act like the
// built in select. (OpenCL v1.1 s6.3.i)

View File

@ -291,3 +291,13 @@ int4 test15(uint4 V0) {
void test16(float2 a, float2 b) {
float2 t0 = (a + b) / 2;
}
typedef char char16 __attribute__((ext_vector_type(16)));
// CHECK: @test17
void test17(void) {
char16 valA;
char valB;
char valC;
char16 destVal = valC ? valA : valB;
}