mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-04 05:31:51 +00:00
Improve the precision of getConstant().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112323 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d4bfd54ec2
commit
ee61fcf98b
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user