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

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 08:53:07 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-aarch64

Author: Will Froom (WillFroom)

<details>
<summary>Changes</summary>

See https://github.com/llvm/llvm-project/issues/123029 for details.

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


1 Files Affected:

- (modified) llvm/lib/Target/AArch64/AArch64ISelLowering.cpp (+5-2) 


``````````diff
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index d4a114c275fb76..32abcfe7a8f452 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)

``````````

</details>


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


More information about the llvm-commits mailing list