mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Fix constant folding of constexprs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5971 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
99df25f9f1
commit
fe32e0c578
@ -186,12 +186,9 @@ static inline Value *dyn_castNegVal(Value *V) {
|
|||||||
if (BinaryOperator::isNeg(V))
|
if (BinaryOperator::isNeg(V))
|
||||||
return BinaryOperator::getNegArgument(cast<BinaryOperator>(V));
|
return BinaryOperator::getNegArgument(cast<BinaryOperator>(V));
|
||||||
|
|
||||||
// Constants can be considered to be negated values...
|
// Constants can be considered to be negated values if they can be folded...
|
||||||
if (Constant *C = dyn_cast<Constant>(V)) {
|
if (Constant *C = dyn_cast<Constant>(V))
|
||||||
Constant *NC = *Constant::getNullValue(V->getType()) - *C;
|
return *Constant::getNullValue(V->getType()) - *C;
|
||||||
assert(NC && "Couldn't constant fold a subtract!");
|
|
||||||
return NC;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user