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 | 38f6b7fe3b576b361a1da1b6381f4ec3f454af65 (patch) | |
tree | 54ef225df53ec1837c0b2232fca30eadd9f529b6 /llvm/lib/Analysis/LazyValueInfo.cpp | |
parent | 13ce07fa928ba20d6369195dd62bc3599172bf16 (diff) | |
download | bcm5719-llvm-38f6b7fe3b576b361a1da1b6381f4ec3f454af65.tar.gz bcm5719-llvm-38f6b7fe3b576b361a1da1b6381f4ec3f454af65.zip |
Improve the precision of getConstant().
llvm-svn: 112323
Diffstat (limited to 'llvm/lib/Analysis/LazyValueInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/LazyValueInfo.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp index 7e00f143c65..e7929f3127b 100644 --- a/llvm/lib/Analysis/LazyValueInfo.cpp +++ b/llvm/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; } |