[llvm] [AArch64] Return early rather than asserting when Size of value passed to targetShrinkDemandedConstant is not 32 or 64 (PR #123084)

Will Froom via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 08:56:57 PST 2025


https://github.com/WillFroom updated https://github.com/llvm/llvm-project/pull/123084

>From 9a71a35c4175914f6f9a644c3c6e743ccfbb65bb Mon Sep 17 00:00:00 2001
From: Will Froom <willfroom at google.com>
Date: Wed, 15 Jan 2025 16:32:31 +0000
Subject: [PATCH] [AArch64] Return early rather than asserting when Size of
 value passed to targetShrinkDemandedConstant is not 32 or 64

---
 llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index d4a114c275fb76..f50c29efa66ec6 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -2373,8 +2373,11 @@ bool AArch64TargetLowering::targetShrinkDemandedConstant(
     return false;
 
   unsigned Size = VT.getSizeInBits();
-  assert((Size == 32 || Size == 64) &&
-         "i32 or i64 is expected after legalization.");
+
+  if((Size != 32) || (Size != 64))
+  {
+    return false;
+  }
 
   // Exit early if we demand all bits.
   if (DemandedBits.popcount() == Size)



More information about the llvm-commits mailing list