[llvm] [SDAG] Don't allow implicit trunc in getConstant() (PR #117558)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 09:07:45 PST 2024


================
@@ -1638,14 +1638,8 @@ SDValue SelectionDAG::getBoolConstant(bool V, const SDLoc &DL, EVT VT,
 SDValue SelectionDAG::getConstant(uint64_t Val, const SDLoc &DL, EVT VT,
                                   bool isT, bool isO) {
   EVT EltVT = VT.getScalarType();
-  assert((EltVT.getSizeInBits() >= 64 ||
-          (uint64_t)((int64_t)Val >> EltVT.getSizeInBits()) + 1 < 2) &&
-         "getConstant with a uint64_t value that doesn't fit in the type!");
-  // TODO: Avoid implicit trunc?
-  // See https://github.com/llvm/llvm-project/issues/112510.
-  return getConstant(APInt(EltVT.getSizeInBits(), Val, /*isSigned=*/false,
-                           /*implicitTrunc=*/true),
-                     DL, VT, isT, isO);
+  return getConstant(APInt(EltVT.getSizeInBits(), Val, /*isSigned=*/false), DL,
----------------
RKSimon wrote:

EltVT.getSizeInBits() -> VT.getScalarSizeInBits()

https://github.com/llvm/llvm-project/pull/117558


More information about the llvm-commits mailing list