projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d4bfd54
)
Improve the precision of getConstant().
author
Owen Anderson
<resistor@mac.com>
Fri, 27 Aug 2010 23:29:38 +0000
(23:29 +0000)
committer
Owen Anderson
<resistor@mac.com>
Fri, 27 Aug 2010 23:29:38 +0000
(23:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112323
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Analysis/LazyValueInfo.cpp
patch
|
blob
|
history
diff --git
a/lib/Analysis/LazyValueInfo.cpp
b/lib/Analysis/LazyValueInfo.cpp
index 7e00f143c65b16c63da22beb7525fa14563ecd90..e7929f3127bf928a511b1313e2f24d217105540a 100644
(file)
--- 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;
}