[llvm-branch-commits] [cfe-branch] r71377 - /cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp
Mike Stump
mrs at apple.com
Sat May 9 20:11:37 PDT 2009
Author: mrs
Date: Sat May 9 22:11:36 2009
New Revision: 71377
URL: http://llvm.org/viewvc/llvm-project?rev=71377&view=rev
Log:
Merge in 71355:
Do not layer a TypedViewRegion when casting symbolic or alloca regions.
Modify getLValueElement accordingly. Now we don't require base region
to be a typed region. Do not create TypedViewRegion when base region is
symbolic or alloca region. We can do so because each element region has
its type information.
Modified:
cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp
Modified: cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp?rev=71377&r1=71376&r2=71377&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/RegionStore.cpp Sat May 9 22:11:36 2009
@@ -416,15 +416,7 @@
if (!isa<nonloc::ConcreteInt>(Offset))
return UnknownVal();
- const TypedRegion* BaseRegion = 0;
-
- const MemRegion* R = cast<loc::MemRegionVal>(Base).getRegion();
- if (const SymbolicRegion* SR = dyn_cast<SymbolicRegion>(R)) {
- SymbolRef Sym = SR->getSymbol();
- BaseRegion = MRMgr.getTypedViewRegion(Sym->getType(getContext()), SR);
- }
- else
- BaseRegion = cast<TypedRegion>(R);
+ const MemRegion* BaseRegion = cast<loc::MemRegionVal>(Base).getRegion();
// Pointer of any type can be cast and used as array base.
const ElementRegion *ElemR = dyn_cast<ElementRegion>(BaseRegion);
@@ -437,7 +429,7 @@
// char *p = __builtin_alloc(10);
// p[1] = 8;
//
- // Observe that 'p' binds to an TypedViewRegion<AllocaRegion>.
+ // Observe that 'p' binds to an AllocaRegion.
//
// Offset might be unsigned. We have to convert it to signed ConcreteInt.
@@ -467,7 +459,7 @@
// can't we need to put a comment here. If it can, we should handle it.
assert(BaseIdxI.getBitWidth() >= OffI.getBitWidth());
- const TypedRegion *ArrayR = cast<TypedRegion>(ElemR->getSuperRegion());
+ const MemRegion *ArrayR = ElemR->getSuperRegion();
SVal NewIdx;
if (OffI.isUnsigned() || OffI.getBitWidth() < BaseIdxI.getBitWidth()) {
@@ -581,6 +573,10 @@
return UnknownVal();
}
+ if (isa<AllocaRegion>(R)) {
+ return UnknownVal();
+ }
+
if (isa<ElementRegion>(R)) {
return UnknownVal();
}
@@ -650,8 +646,8 @@
// to be re-used for a different purpose.
if (isa<SymbolicRegion>(R) || isa<AllocaRegion>(R)) {
- const MemRegion* ViewR = MRMgr.getTypedViewRegion(CastToTy, R);
- return CastResult(AddRegionView(state, ViewR, R), ViewR);
+ state = setCastType(state, R, ToTy);
+ return CastResult(state, R);
}
// VarRegion, ElementRegion, and FieldRegion has an inherent type. Normally
More information about the llvm-branch-commits
mailing list