diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-03-15 16:05:15 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-03-15 16:05:15 +0000 |
| commit | f53c2c785cd37ffd76f0a5db506fdef0ca9f100e (patch) | |
| tree | 0ecacee4d4e49f2c05dd2b7f137d2ad4c12ff8a1 | |
| parent | 350b08e5c37fc2f437acf21017b24f6c59e9a2ca (diff) | |
| download | external_llvm-f53c2c785cd37ffd76f0a5db506fdef0ca9f100e.zip external_llvm-f53c2c785cd37ffd76f0a5db506fdef0ca9f100e.tar.gz external_llvm-f53c2c785cd37ffd76f0a5db506fdef0ca9f100e.tar.bz2 | |
sink the call to VT.getSizeInBits() down into its uses,
not all unary nodes necessarily have a simple result type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98547 91177308-0d34-0410-b5e6-96231b3b80d8
| -rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index e09a4da..5d38fdd 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -2329,22 +2329,20 @@ SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, // Constant fold unary operations with an integer constant operand. if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Operand.getNode())) { const APInt &Val = C->getAPIntValue(); - unsigned BitWidth = VT.getSizeInBits(); switch (Opcode) { default: break; case ISD::SIGN_EXTEND: - return getConstant(APInt(Val).sextOrTrunc(BitWidth), VT); + return getConstant(APInt(Val).sext(VT.getSizeInBits()), VT); case ISD::ANY_EXTEND: case ISD::ZERO_EXTEND: case ISD::TRUNCATE: - return getConstant(APInt(Val).zextOrTrunc(BitWidth), VT); + return getConstant(APInt(Val).zextOrTrunc(VT.getSizeInBits()), VT); case ISD::UINT_TO_FP: case ISD::SINT_TO_FP: { const uint64_t zero[] = {0, 0}; - // No compile time operations on this type. - if (VT==MVT::ppcf128) - break; - APFloat apf = APFloat(APInt(BitWidth, 2, zero)); + // No compile time operations on ppcf128. + if (VT == MVT::ppcf128) break; + APFloat apf = APFloat(APInt(VT.getSizeInBits(), 2, zero)); (void)apf.convertFromAPInt(Val, Opcode==ISD::SINT_TO_FP, APFloat::rmNearestTiesToEven); |
