[llvm] CodeGen: Add ISD::AssertNoFPClass (PR #138839)

YunQiang Su via llvm-commits llvm-commits at lists.llvm.org
Wed May 7 18:04:09 PDT 2025


================
@@ -796,6 +798,8 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
   //===--------------------------------------------------------------------===//
 
   SDValue GetSoftPromotedHalf(SDValue Op) {
+    while (Op.getNode()->getOpcode() == ISD::AssertNoFPClass)
+      Op = Op.getNode()->getOperand(0);
----------------
wzssyqa wrote:

Sorry. Without this it will not trigger an internal error, instead some duplicated promote operation will emit like this

```
target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "thumbv7em-unknown-none-eabi"

define nofpclass(nan inf) half @f1(half returned nofpclass(nan inf) %x) {
entry:
  ret half %x
}
```
will emit
```
f1:
        .fnstart
@ %bb.0:                                @ %entry
        .save   {r7, lr}
        push    {r7, lr}
        uxth    r0, r0
        bl      __aeabi_h2f
        bl      __aeabi_f2h
        pop     {r7, pc}
```

I guess there will be some same problem will be happened for `AssertSext` or `AssertZext`.

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


More information about the llvm-commits mailing list