mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-29 22:52:18 +00:00
Constant exprs are not efficiently negatable in practice. This disables
turning X - (constantexpr) into X + (-constantexpr) among other things. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18935 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3b0cc78c60
commit
0ce8580fcd
@ -309,10 +309,9 @@ static inline Value *dyn_castNegVal(Value *V) {
|
||||
if (BinaryOperator::isNeg(V))
|
||||
return BinaryOperator::getNegArgument(cast<BinaryOperator>(V));
|
||||
|
||||
// Constants can be considered to be negated values if they can be folded...
|
||||
if (Constant *C = dyn_cast<Constant>(V))
|
||||
if (!isa<UndefValue>(C))
|
||||
return ConstantExpr::getNeg(C);
|
||||
// Constants can be considered to be negated values if they can be folded.
|
||||
if (ConstantInt *C = dyn_cast<ConstantInt>(V))
|
||||
return ConstantExpr::getNeg(C);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user