[llvm] [SelectionDAG] Remove unneeded assert from SelectionDAG::getSignedConstant. NFC (PR #114336)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 4 11:05:07 PST 2024
https://github.com/topperc updated https://github.com/llvm/llvm-project/pull/114336
>From 8f9af2cd39aa421e8f0c8c8bc14e577af9277668 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Wed, 30 Oct 2024 17:38:09 -0700
Subject: [PATCH 1/2] [SelectionDAG] Remove unneeded assert from
SelectionDAG::getSignedConstant. NFC
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.
---
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
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,
>From df90116d602a6286d5336e43b08f3943c3223afe Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Mon, 4 Nov 2024 11:04:48 -0800
Subject: [PATCH 2/2] fixup! remove implicitTrunc=false
---
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 15108db53675af..3b97566e1079ae 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -1773,9 +1773,7 @@ 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();
- return getConstant(
- APInt(Size, Val, /*isSigned=*/true, /*implicitTrunc=*/false), DL, VT, isT,
- isO);
+ return getConstant(APInt(Size, Val, /*isSigned=*/true), DL, VT, isT, isO);
}
SDValue SelectionDAG::getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget,
More information about the llvm-commits
mailing list