[cfe-commits] r59225 - in /cfe/trunk: lib/Analysis/CFRefCount.cpp lib/Analysis/GRExprEngine.cpp lib/Analysis/GRSimpleVals.cpp test/Analysis/misc-ps.m
Ted Kremenek
kremenek at apple.com
Wed Nov 12 22:10:40 PST 2008
Author: kremenek
Date: Thu Nov 13 00:10:40 2008
New Revision: 59225
URL: http://llvm.org/viewvc/llvm-project?rev=59225&view=rev
Log:
GRExprEngine/CFRefCount/GRSimpleVals: We don't do any special handling (yet) of vector types. Add explicit checks that when we process integers that they really are scalars.
Modified:
cfe/trunk/lib/Analysis/CFRefCount.cpp
cfe/trunk/lib/Analysis/GRExprEngine.cpp
cfe/trunk/lib/Analysis/GRSimpleVals.cpp
cfe/trunk/test/Analysis/misc-ps.m
Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=59225&r1=59224&r2=59225&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Thu Nov 13 00:10:40 2008
@@ -1605,7 +1605,7 @@
QualType T = R->getType(Ctx);
// FIXME: handle structs.
- if (T->isIntegerType() || Loc::IsLocType(T)) {
+ if (Loc::IsLocType(T) || (T->isIntegerType() && T->isScalarType())) {
SymbolID NewSym =
Eng.getSymbolManager().getConjuredSymbol(*I, T, Count);
@@ -1669,7 +1669,7 @@
QualType T = Ex->getType();
- if (T->isIntegerType() || Loc::IsLocType(T)) {
+ if (Loc::IsLocType(T) || (T->isIntegerType() && T->isScalarType())) {
unsigned Count = Builder.getCurrentBlockCount();
SymbolID Sym = Eng.getSymbolManager().getConjuredSymbol(Ex, Count);
Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=59225&r1=59224&r2=59225&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Thu Nov 13 00:10:40 2008
@@ -1742,7 +1742,7 @@
SymbolID Sym = SymMgr.getConjuredSymbol(InitEx, Count);
InitVal = loc::SymbolVal(Sym);
}
- else if (T->isIntegerType()) {
+ else if (T->isIntegerType() && T->isScalarType()) {
SymbolID Sym = SymMgr.getConjuredSymbol(InitEx, Count);
InitVal = nonloc::SymbolVal(Sym);
}
@@ -1835,6 +1835,13 @@
return;
}
+ if (T->isUnionType() || T->isVectorType()) {
+ // FIXME: to be implemented.
+ // Note: That vectors can return true for T->isIntegerType()
+ MakeNode(Dst, E, Pred, state);
+ return;
+ }
+
if (Loc::IsLocType(T) || T->isIntegerType()) {
assert (E->getNumInits() == 1);
NodeSet Tmp;
@@ -1847,11 +1854,6 @@
return;
}
- if (T->isUnionType() || T->isVectorType()) {
- // FIXME: to be implemented.
- MakeNode(Dst, E, Pred, state);
- return;
- }
printf("InitListExpr type = %s\n", T.getAsString().c_str());
assert(0 && "unprocessed InitListExpr type");
@@ -2338,11 +2340,12 @@
// FIXME: Handle structs.
QualType T = RHS->getType();
- if (RightV.isUnknown() && (T->isIntegerType() || Loc::IsLocType(T))) {
+ if (RightV.isUnknown() && (Loc::IsLocType(T) ||
+ (T->isScalarType() && T->isIntegerType()))) {
unsigned Count = Builder->getCurrentBlockCount();
SymbolID Sym = SymMgr.getConjuredSymbol(B->getRHS(), Count);
- RightV = Loc::IsLocType(B->getRHS()->getType())
+ RightV = Loc::IsLocType(T)
? cast<SVal>(loc::SymbolVal(Sym))
: cast<SVal>(nonloc::SymbolVal(Sym));
}
@@ -2358,7 +2361,9 @@
case BinaryOperator::Rem:
// Special checking for integer denominators.
- if (RHS->getType()->isIntegerType()) {
+ if (RHS->getType()->isIntegerType() &&
+ RHS->getType()->isScalarType()) {
+
St = CheckDivideZero(B, St, *I2, RightV);
if (!St) continue;
}
@@ -2429,7 +2434,8 @@
// Check for divide-by-zero.
if ((Op == BinaryOperator::Div || Op == BinaryOperator::Rem)
- && RHS->getType()->isIntegerType()) {
+ && RHS->getType()->isIntegerType()
+ && RHS->getType()->isScalarType()) {
// CheckDivideZero returns a new state where the denominator
// is assumed to be non-zero.
@@ -2489,8 +2495,8 @@
// EXPERIMENTAL: "Conjured" symbols.
// FIXME: Handle structs.
- if (Result.isUnknown() &&
- (CTy->isIntegerType() || Loc::IsLocType(CTy))) {
+ if (Result.isUnknown() && (Loc::IsLocType(CTy) ||
+ (CTy->isScalarType() && CTy->isIntegerType()))) {
unsigned Count = Builder->getCurrentBlockCount();
SymbolID Sym = SymMgr.getConjuredSymbol(B->getRHS(), Count);
Modified: cfe/trunk/lib/Analysis/GRSimpleVals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRSimpleVals.cpp?rev=59225&r1=59224&r2=59225&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRSimpleVals.cpp (original)
+++ cfe/trunk/lib/Analysis/GRSimpleVals.cpp Thu Nov 13 00:10:40 2008
@@ -381,7 +381,7 @@
// FIXME: We eventually should handle structs and other compound types
// that are returned by value.
QualType T = CE->getType();
- if (T->isIntegerType() || Loc::IsLocType(T)) {
+ if (Loc::IsLocType(T) || (T->isIntegerType() && T->isScalarType())) {
unsigned Count = Builder.getCurrentBlockCount();
SymbolID Sym = Eng.getSymbolManager().getConjuredSymbol(CE, Count);
Modified: cfe/trunk/test/Analysis/misc-ps.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps.m?rev=59225&r1=59224&r2=59225&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps.m (original)
+++ cfe/trunk/test/Analysis/misc-ps.m Thu Nov 13 00:10:40 2008
@@ -61,6 +61,17 @@
typedef float __m128 __attribute__((__vector_size__(16), __may_alias__));
__m128 return128() {
+ // This compound literal has a Vector type. We currently just
+ // return UnknownVal.
return __extension__(__m128) { 0.0f, 0.0f, 0.0f, 0.0f };
}
+typedef long long __v2di __attribute__ ((__vector_size__ (16)));
+typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
+__m128i vec128i(long long __q1, long long __q0) {
+ // This compound literal returns true for both isVectorType() and
+ // isIntegerType().
+ return __extension__ (__m128i)(__v2di){ __q0, __q1 };
+}
+
+
More information about the cfe-commits
mailing list