mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
DAGCombiner: Continue combining if FoldConstantArithmetic() fails.
DAG.FoldConstantArithmetic() can fail even though both operands are Constants if OpaqueConstants are involved. Continue trying other combine possibilities in tis case. Differential Revision: http://reviews.llvm.org/D6946 Somewhat related to PR21801 / rdar://19211454 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237822 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1086,9 +1086,19 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
||||
|
||||
// If we know the value of all of the demanded bits, return this as a
|
||||
// constant.
|
||||
if ((NewMask & (KnownZero|KnownOne)) == NewMask)
|
||||
if ((NewMask & (KnownZero|KnownOne)) == NewMask) {
|
||||
// Avoid folding to a constant if any OpaqueConstant is involved.
|
||||
const SDNode *N = Op.getNode();
|
||||
for (SDNodeIterator I = SDNodeIterator::begin(N),
|
||||
E = SDNodeIterator::end(N); I != E; ++I) {
|
||||
SDNode *Op = *I;
|
||||
if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op))
|
||||
if (C->isOpaque())
|
||||
return false;
|
||||
}
|
||||
return TLO.CombineTo(Op,
|
||||
TLO.DAG.getConstant(KnownOne, dl, Op.getValueType()));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user