diff options
author | Owen Anderson <resistor@mac.com> | 2010-08-27 23:29:38 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2010-08-27 23:29:38 +0000 |
commit | ee61fcf98bb84e7e9f3450035bef92c4d087c0ae (patch) | |
tree | 6228aa9f5c2400a67dc055b90043c1d618b5b9c0 /lib/Analysis/LazyValueInfo.cpp | |
parent | d4bfd54ec2947e73ab152c3c548e4dd4beb700ba (diff) | |
download | external_llvm-ee61fcf98bb84e7e9f3450035bef92c4d087c0ae.zip external_llvm-ee61fcf98bb84e7e9f3450035bef92c4d087c0ae.tar.gz external_llvm-ee61fcf98bb84e7e9f3450035bef92c4d087c0ae.tar.bz2 |
Improve the precision of getConstant().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112323 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LazyValueInfo.cpp')
-rw-r--r-- | lib/Analysis/LazyValueInfo.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Analysis/LazyValueInfo.cpp b/lib/Analysis/LazyValueInfo.cpp index 7e00f14..e7929f3 100644 --- a/lib/Analysis/LazyValueInfo.cpp +++ b/lib/Analysis/LazyValueInfo.cpp @@ -846,6 +846,11 @@ Constant *LazyValueInfo::getConstant(Value *V, BasicBlock *BB) { if (Result.isConstant()) return Result.getConstant(); + else if (Result.isConstantRange()) { + ConstantRange CR = Result.getConstantRange(); + if (const APInt *SingleVal = CR.getSingleElement()) + return ConstantInt::get(V->getContext(), *SingleVal); + } return 0; } |