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:
parent
e7d746d8b9
commit
09c2213ce6
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue