[cfe-commits] r45600 - /cfe/trunk/Sema/SemaExpr.cpp
Chris Lattner
sabre at nondot.org
Fri Jan 4 15:20:56 PST 2008
Author: lattner
Date: Fri Jan 4 17:20:56 2008
New Revision: 45600
URL: http://llvm.org/viewvc/llvm-project?rev=45600&view=rev
Log:
we already test for exact type matches early, so we don't have to do
it explicitly for vectors. This allows us to unnest some code.
Modified:
cfe/trunk/Sema/SemaExpr.cpp
Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=45600&r1=45599&r2=45600&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Fri Jan 4 17:20:56 2008
@@ -1111,24 +1111,21 @@
if (LV->getElementType().getTypePtr() == rhsType.getTypePtr())
return Compatible;
}
- if (!getLangOptions().LaxVectorConversions) {
- if (lhsType != rhsType)
- return Incompatible;
- } else {
- if (lhsType->isVectorType() && rhsType->isVectorType()) {
- // If LHS and RHS are both integer or both floating point types, and
- // the total vector length is the same, allow the conversion. This is
- // a bitcast; no bits are changed but the result type is different.
- if ((lhsType->isIntegerType() && rhsType->isIntegerType()) ||
- (lhsType->isRealFloatingType() &&
- rhsType->isRealFloatingType())) {
- if (Context.getTypeSize(lhsType, SourceLocation()) ==
- Context.getTypeSize(rhsType, SourceLocation()))
- return Compatible;
- }
+
+ if (getLangOptions().LaxVectorConversions &&
+ lhsType->isVectorType() && rhsType->isVectorType()) {
+ // If LHS and RHS are both integer or both floating point types, and
+ // the total vector length is the same, allow the conversion. This is
+ // a bitcast; no bits are changed but the result type is different.
+ if ((lhsType->isIntegerType() && rhsType->isIntegerType()) ||
+ (lhsType->isRealFloatingType() &&
+ rhsType->isRealFloatingType())) {
+ if (Context.getTypeSize(lhsType, SourceLocation()) ==
+ Context.getTypeSize(rhsType, SourceLocation()))
+ return Compatible;
}
- return Incompatible;
}
+ return Incompatible;
}
return Compatible;
}
More information about the cfe-commits
mailing list