[llvm-commits] [llvm] r112323 - /llvm/trunk/lib/Analysis/LazyValueInfo.cpp
Owen Anderson
resistor at mac.com
Fri Aug 27 16:29:38 PDT 2010
Author: resistor
Date: Fri Aug 27 18:29:38 2010
New Revision: 112323
URL: http://llvm.org/viewvc/llvm-project?rev=112323&view=rev
Log:
Improve the precision of getConstant().
Modified:
llvm/trunk/lib/Analysis/LazyValueInfo.cpp
Modified: llvm/trunk/lib/Analysis/LazyValueInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyValueInfo.cpp?rev=112323&r1=112322&r2=112323&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyValueInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyValueInfo.cpp Fri Aug 27 18:29:38 2010
@@ -846,6 +846,11 @@
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;
}
More information about the llvm-commits
mailing list