[llvm] [SelectionDAG] Remove unneeded assert from SelectionDAG::getSignedConstant. NFC (PR #114336)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 17:49:36 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-selectiondag

Author: Craig Topper (topperc)

<details>
<summary>Changes</summary>

This assert is also present inside the APInt constructor after #<!-- -->106524, but its not yet enabled by default. So we also need to pass false to the implicitTrunc flag.

---
Full diff: https://github.com/llvm/llvm-project/pull/114336.diff


1 Files Affected:

- (modified) llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (+3-4) 


``````````diff
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 5403d787861d46..dd701bcea14b6e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -1772,10 +1772,9 @@ SDValue SelectionDAG::getConstant(const ConstantInt &Val, const SDLoc &DL,
 SDValue SelectionDAG::getSignedConstant(int64_t Val, const SDLoc &DL, EVT VT,
                                         bool isT, bool isO) {
   unsigned Size = VT.getScalarSizeInBits();
-  assert(
-      isIntN(Size, Val) &&
-      "getSignedConstant with a int64_t value that doesn't fit in the type!");
-  return getConstant(APInt(Size, Val, true), DL, VT, isT, isO);
+  return getConstant(
+      APInt(Size, Val, /*isSigned=*/true, /*implicitTrunc=*/false), DL, VT, isT,
+      isO);
 }
 
 SDValue SelectionDAG::getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget,

``````````

</details>


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


More information about the llvm-commits mailing list