mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 06:30:16 +00:00
[DAG] Keep the opaque constant flag when performing unary constant folding operations.
Usually opaque constants shouldn't be folded, unless they are simple unary operations that don't create new constants. Although this shouldn't drop the opaque constant flag. This commit fixes this. Related to <rdar://problem/14774662> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204737 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6f4f46cf11
commit
6ac0491001
@ -2541,11 +2541,13 @@ SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL,
|
||||
switch (Opcode) {
|
||||
default: break;
|
||||
case ISD::SIGN_EXTEND:
|
||||
return getConstant(Val.sextOrTrunc(VT.getSizeInBits()), VT);
|
||||
return getConstant(Val.sextOrTrunc(VT.getSizeInBits()), VT,
|
||||
C->isTargetOpcode(), C->isOpaque());
|
||||
case ISD::ANY_EXTEND:
|
||||
case ISD::ZERO_EXTEND:
|
||||
case ISD::TRUNCATE:
|
||||
return getConstant(Val.zextOrTrunc(VT.getSizeInBits()), VT);
|
||||
return getConstant(Val.zextOrTrunc(VT.getSizeInBits()), VT,
|
||||
C->isTargetOpcode(), C->isOpaque());
|
||||
case ISD::UINT_TO_FP:
|
||||
case ISD::SINT_TO_FP: {
|
||||
APFloat apf(EVTToAPFloatSemantics(VT),
|
||||
@ -2562,15 +2564,19 @@ SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL,
|
||||
return getConstantFP(APFloat(APFloat::IEEEdouble, Val), VT);
|
||||
break;
|
||||
case ISD::BSWAP:
|
||||
return getConstant(Val.byteSwap(), VT);
|
||||
return getConstant(Val.byteSwap(), VT, C->isTargetOpcode(),
|
||||
C->isOpaque());
|
||||
case ISD::CTPOP:
|
||||
return getConstant(Val.countPopulation(), VT);
|
||||
return getConstant(Val.countPopulation(), VT, C->isTargetOpcode(),
|
||||
C->isOpaque());
|
||||
case ISD::CTLZ:
|
||||
case ISD::CTLZ_ZERO_UNDEF:
|
||||
return getConstant(Val.countLeadingZeros(), VT);
|
||||
return getConstant(Val.countLeadingZeros(), VT, C->isTargetOpcode(),
|
||||
C->isOpaque());
|
||||
case ISD::CTTZ:
|
||||
case ISD::CTTZ_ZERO_UNDEF:
|
||||
return getConstant(Val.countTrailingZeros(), VT);
|
||||
return getConstant(Val.countTrailingZeros(), VT, C->isTargetOpcode(),
|
||||
C->isOpaque());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user