aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-12 04:57:13 +0000
committerChris Lattner <sabre@nondot.org>2009-11-12 04:57:13 +0000
commitf496e79f44f13ac80564f5f8e69aa648033e7889 (patch)
treedb7e4b17f8e5deaf91fb6e67427d4fb80abc1805 /lib/Analysis
parent0e0ff29271df58e3bc545e40f5432c436e8bd76b (diff)
downloadexternal_llvm-f496e79f44f13ac80564f5f8e69aa648033e7889.zip
external_llvm-f496e79f44f13ac80564f5f8e69aa648033e7889.tar.gz
external_llvm-f496e79f44f13ac80564f5f8e69aa648033e7889.tar.bz2
various fixes to the lattice transfer functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86952 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/LazyValueInfo.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/lib/Analysis/LazyValueInfo.cpp b/lib/Analysis/LazyValueInfo.cpp
index 659fa47..d569b85 100644
--- a/lib/Analysis/LazyValueInfo.cpp
+++ b/lib/Analysis/LazyValueInfo.cpp
@@ -141,19 +141,40 @@ public:
if (RHS.isNotConstant()) {
if (isNotConstant()) {
- if (getNotConstant() != RHS.getNotConstant())
+ if (getNotConstant() != RHS.getNotConstant() ||
+ isa<ConstantExpr>(getNotConstant()) ||
+ isa<ConstantExpr>(RHS.getNotConstant()))
return markOverdefined();
return false;
}
- if (isConstant() && getConstant() != RHS.getNotConstant())
- return markOverdefined();
+ if (isConstant()) {
+ if (getConstant() == RHS.getNotConstant() ||
+ isa<ConstantExpr>(RHS.getNotConstant()) ||
+ isa<ConstantExpr>(getConstant()))
+ return markOverdefined();
+ return markNotConstant(RHS.getNotConstant());
+ }
+
+ assert(isUndefined() && "Unexpected lattice");
return markNotConstant(RHS.getNotConstant());
}
- // RHS must be a constant, we must be undef or constant.
- if (isConstant() && getConstant() != RHS.getConstant())
+ // RHS must be a constant, we must be undef, constant, or notconstant.
+ if (isUndefined())
+ return markConstant(RHS.getConstant());
+
+ if (isConstant()) {
+ if (getConstant() != RHS.getConstant())
+ return markOverdefined();
+ return false;
+ }
+
+ // If we are known "!=4" and RHS is "==5", stay at "!=4".
+ if (getNotConstant() == RHS.getConstant() ||
+ isa<ConstantExpr>(getNotConstant()) ||
+ isa<ConstantExpr>(RHS.getConstant()))
return markOverdefined();
- return markConstant(RHS.getConstant());
+ return false;
}
};