summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/LazyValueInfo.cpp
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
commit22db4b5e0ce40255127e97ec2605f539d254755a (patch)
treeb1c443df681ff4efd5279844936d171a75ec81ec /llvm/lib/Analysis/LazyValueInfo.cpp
parentc893c4ed101307b08cda4cbbdc10b36ce59a4608 (diff)
downloadbcm5719-llvm-22db4b5e0ce40255127e97ec2605f539d254755a.tar.gz
bcm5719-llvm-22db4b5e0ce40255127e97ec2605f539d254755a.zip
various fixes to the lattice transfer functions.
llvm-svn: 86952
Diffstat (limited to 'llvm/lib/Analysis/LazyValueInfo.cpp')
-rw-r--r--llvm/lib/Analysis/LazyValueInfo.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index 659fa471aa8..d569b8595d1 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/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;
}
};
OpenPOWER on IntegriCloud